summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--ssh.c20
2 files changed, 25 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index cf4da7124..d5a62dcc5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -9,6 +9,12 @@
9 - (dtucker) [monitor.c] Remove the !HAVE_SOCKETPAIR case. We use socketpair 9 - (dtucker) [monitor.c] Remove the !HAVE_SOCKETPAIR case. We use socketpair
10 unconditionally in other places and the survey data we have does not show 10 unconditionally in other places and the survey data we have does not show
11 any systems that use it. "nuke it" djm@ 11 any systems that use it. "nuke it" djm@
12 - djm@cvs.openbsd.org 2011/06/03 00:54:38
13 [ssh.c]
14 bz#1883 - setproctitle() to identify mux master; patch from Bert.Wesarg
15 AT googlemail.com; ok dtucker@
16 NB. includes additional portability code to enable setproctitle emulation
17 on platforms that don't support it.
12 18
1320110529 1920110529
14 - (djm) OpenBSD CVS Sync 20 - (djm) OpenBSD CVS Sync
diff --git a/ssh.c b/ssh.c
index e7e15cd65..900537581 100644
--- a/ssh.c
+++ b/ssh.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssh.c,v 1.361 2011/05/24 07:15:47 djm Exp $ */ 1/* $OpenBSD: ssh.c,v 1.362 2011/06/03 00:54:38 djm Exp $ */
2/* 2/*
3 * Author: Tatu Ylonen <ylo@cs.hut.fi> 3 * Author: Tatu Ylonen <ylo@cs.hut.fi>
4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -111,6 +111,11 @@
111 111
112extern char *__progname; 112extern char *__progname;
113 113
114/* Saves a copy of argv for setproctitle emulation */
115#ifndef HAVE_SETPROCTITLE
116static char **saved_av;
117#endif
118
114/* Flag indicating whether debug mode is on. May be set on the command line. */ 119/* Flag indicating whether debug mode is on. May be set on the command line. */
115int debug_flag = 0; 120int debug_flag = 0;
116 121
@@ -240,6 +245,7 @@ main(int ac, char **av)
240 int dummy, timeout_ms; 245 int dummy, timeout_ms;
241 extern int optind, optreset; 246 extern int optind, optreset;
242 extern char *optarg; 247 extern char *optarg;
248
243 struct servent *sp; 249 struct servent *sp;
244 Forward fwd; 250 Forward fwd;
245 251
@@ -248,6 +254,17 @@ main(int ac, char **av)
248 254
249 __progname = ssh_get_progname(av[0]); 255 __progname = ssh_get_progname(av[0]);
250 256
257#ifndef HAVE_SETPROCTITLE
258 /* Prepare for later setproctitle emulation */
259 /* Save argv so it isn't clobbered by setproctitle() emulation */
260 saved_av = xcalloc(ac + 1, sizeof(*saved_av));
261 for (i = 0; i < ac; i++)
262 saved_av[i] = xstrdup(av[i]);
263 saved_av[i] = NULL;
264 compat_init_setproctitle(ac, av);
265 av = saved_av;
266#endif
267
251 /* 268 /*
252 * Discard other fds that are hanging around. These can cause problem 269 * Discard other fds that are hanging around. These can cause problem
253 * with backgrounded ssh processes started by ControlPersist. 270 * with backgrounded ssh processes started by ControlPersist.
@@ -977,6 +994,7 @@ control_persist_detach(void)
977 if (devnull > STDERR_FILENO) 994 if (devnull > STDERR_FILENO)
978 close(devnull); 995 close(devnull);
979 } 996 }
997 setproctitle("%s [mux]", options.control_path);
980} 998}
981 999
982/* Do fork() after authentication. Used by "ssh -f" */ 1000/* Do fork() after authentication. Used by "ssh -f" */