Bugzilla – Attachment 2024 Details for
Bug 1883
use setproctitle for persistent mux master
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
implementation
0001-ssh-use-setproctitle-for-persistent-mux-master.patch (text/plain), 1.98 KB, created by
Bert Wesarg
on 2011-03-28 17:57:58 AEDT
(
hide
)
Description:
implementation
Filename:
MIME Type:
Creator:
Bert Wesarg
Created:
2011-03-28 17:57:58 AEDT
Size:
1.98 KB
patch
obsolete
>From d0560ac1878f8bfff9a05e883a8ced757fd305db Mon Sep 17 00:00:00 2001 >Message-Id: <d0560ac1878f8bfff9a05e883a8ced757fd305db.1301295099.git.bert.wesarg@googlemail.com> >From: Bert Wesarg <bert.wesarg@googlemail.com> >Date: Mon, 28 Mar 2011 08:50:38 +0200 >Subject: [PATCH] ssh: use setproctitle for persistent mux master > >Preserving the command line from the invoking ssh command doesn't >make much sense, so use setproctitle() to hide the arguments. And >chdir into /. >--- > ssh.c | 21 ++++++++++++++++++--- > 1 files changed, 18 insertions(+), 3 deletions(-) > >diff --git a/ssh.c b/ssh.c >index d86477e..d05e92e 100644 >--- a/ssh.c >+++ b/ssh.c >@@ -230,12 +230,25 @@ main(int ac, char **av) > struct servent *sp; > Forward fwd; > >- /* Ensure that fds 0, 1 and 2 are open or directed to /dev/null */ >- sanitise_stdfd(); >- > __progname = ssh_get_progname(av[0]); > init_rng(); > >+#ifndef HAVE_SETPROCTITLE >+ /* Prepare for later setproctitle emulation */ >+ { >+ /* Save argv. Duplicate so setproctitle emulation doesn't clobber it */ >+ char **saved_argv = xcalloc(ac + 1, sizeof(*saved_argv)); >+ for (i = 0; i < ac; i++) >+ saved_argv[i] = xstrdup(av[i]); >+ saved_argv[i] = NULL; >+ compat_init_setproctitle(ac, av); >+ av = saved_argv; >+ } >+#endif >+ >+ /* Ensure that fds 0, 1 and 2 are open or directed to /dev/null */ >+ sanitise_stdfd(); >+ > /* > * Discard other fds that are hanging around. These can cause problem > * with backgrounded ssh processes started by ControlPersist. >@@ -1046,6 +1059,7 @@ control_persist_detach(void) > /* muxclient() doesn't return on success. */ > fatal("Failed to connect to new control master"); > } >+ chdir("/"); > if ((devnull = open(_PATH_DEVNULL, O_RDWR)) == -1) { > error("%s: open(\"/dev/null\"): %s", __func__, > strerror(errno)); >@@ -1056,6 +1070,7 @@ control_persist_detach(void) > if (devnull > STDERR_FILENO) > close(devnull); > } >+ setproctitle("%s [mux]", options.control_path); > } > > /* Do fork() after authentication. Used by "ssh -f" */ >-- >1.7.4.1.1319.ga04f7.dirty >
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 1883
: 2024 |
2040