Bugzilla – Attachment 2982 Details for
Bug 2719
Notify user, when ssh transport process dies.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Notify user, when ssh transport process dies
0002-Notify-user-when-ssh-transfer-process-dies.patch (text/plain), 1.60 KB, created by
Tomas Kuthan
on 2017-05-22 23:18:41 AEST
(
hide
)
Description:
Notify user, when ssh transport process dies
Filename:
MIME Type:
Creator:
Tomas Kuthan
Created:
2017-05-22 23:18:41 AEST
Size:
1.60 KB
patch
obsolete
>From 98d200dd62d8b2d3b7f2b50b28f1023a823e8aad Mon Sep 17 00:00:00 2001 >From: Tomas Kuthan <tkuthan@gmail.com> >Date: Mon, 22 May 2017 14:12:22 +0200 >Subject: [PATCH 2/2] Notify user, when ssh transfer process dies > >When ssh transfer process dies (e.g. if remote side hangs up), the user >does not learn about it, until they try to execute the next remote >command. > >This patch registers a SIGCHLD signal handler, that prints "Connection >closed." on stderr, when ssh transport process dies. >--- > sftp.c | 20 ++++++++++++++++++++ > 1 file changed, 20 insertions(+) > >diff --git a/sftp.c b/sftp.c >index 9737bf5..d4dfae4 100644 >--- a/sftp.c >+++ b/sftp.c >@@ -254,6 +254,24 @@ cmd_interrupt(int signo) > errno = olderrno; > } > >+/* Report if ssh transport process dies. */ >+/*ARGSUSED*/ >+static void >+sigchld_handler(int sig) >+{ >+ int save_errno = errno; >+ pid_t pid; >+ const char msg[] = "\rConnection closed. \n"; >+ >+ while ((pid = waitpid(sshpid, NULL, WNOHANG|WNOWAIT)) == -1 && >+ errno == EINTR) >+ continue; >+ if (pid == sshpid) >+ (void)write(STDERR_FILENO, msg, sizeof(msg) - 1); >+ >+ errno = save_errno; >+} >+ > static void > help(void) > { >@@ -2168,6 +2186,7 @@ interactive_loop(struct sftp_conn *conn, char *file1, char *file2) > if (err != 0) > break; > } >+ signal(SIGCHLD, SIG_DFL); > free(remote_path); > free(conn); > >@@ -2233,6 +2252,7 @@ connect_to_server(char *path, char **args, int *in, int *out) > signal(SIGTERM, killchild); > signal(SIGINT, killchild); > signal(SIGHUP, killchild); >+ signal(SIGCHLD, sigchld_handler); > signal(SIGTSTP, suspchild); > signal(SIGTTIN, suspchild); > signal(SIGTTOU, suspchild); >-- >2.7.4 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 2719
:
2982
|
3002