зеркало из https://github.com/Azure/sonic-openssh.git
- djm@cvs.openbsd.org 2011/06/03 00:54:38
[ssh.c] bz#1883 - setproctitle() to identify mux master; patch from Bert.Wesarg AT googlemail.com; ok dtucker@ NB. includes additional portability code to enable setproctitle emulation on platforms that don't support it.
This commit is contained in:
Родитель
c3c7227ccc
Коммит
ea2c1a4dc6
|
@ -9,6 +9,12 @@
|
|||
- (dtucker) [monitor.c] Remove the !HAVE_SOCKETPAIR case. We use socketpair
|
||||
unconditionally in other places and the survey data we have does not show
|
||||
any systems that use it. "nuke it" djm@
|
||||
- djm@cvs.openbsd.org 2011/06/03 00:54:38
|
||||
[ssh.c]
|
||||
bz#1883 - setproctitle() to identify mux master; patch from Bert.Wesarg
|
||||
AT googlemail.com; ok dtucker@
|
||||
NB. includes additional portability code to enable setproctitle emulation
|
||||
on platforms that don't support it.
|
||||
|
||||
20110529
|
||||
- (djm) OpenBSD CVS Sync
|
||||
|
|
20
ssh.c
20
ssh.c
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: ssh.c,v 1.361 2011/05/24 07:15:47 djm Exp $ */
|
||||
/* $OpenBSD: ssh.c,v 1.362 2011/06/03 00:54:38 djm Exp $ */
|
||||
/*
|
||||
* Author: Tatu Ylonen <ylo@cs.hut.fi>
|
||||
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
|
||||
|
@ -111,6 +111,11 @@
|
|||
|
||||
extern char *__progname;
|
||||
|
||||
/* Saves a copy of argv for setproctitle emulation */
|
||||
#ifndef HAVE_SETPROCTITLE
|
||||
static char **saved_av;
|
||||
#endif
|
||||
|
||||
/* Flag indicating whether debug mode is on. May be set on the command line. */
|
||||
int debug_flag = 0;
|
||||
|
||||
|
@ -240,6 +245,7 @@ main(int ac, char **av)
|
|||
int dummy, timeout_ms;
|
||||
extern int optind, optreset;
|
||||
extern char *optarg;
|
||||
|
||||
struct servent *sp;
|
||||
Forward fwd;
|
||||
|
||||
|
@ -248,6 +254,17 @@ main(int ac, char **av)
|
|||
|
||||
__progname = ssh_get_progname(av[0]);
|
||||
|
||||
#ifndef HAVE_SETPROCTITLE
|
||||
/* Prepare for later setproctitle emulation */
|
||||
/* Save argv so it isn't clobbered by setproctitle() emulation */
|
||||
saved_av = xcalloc(ac + 1, sizeof(*saved_av));
|
||||
for (i = 0; i < ac; i++)
|
||||
saved_av[i] = xstrdup(av[i]);
|
||||
saved_av[i] = NULL;
|
||||
compat_init_setproctitle(ac, av);
|
||||
av = saved_av;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Discard other fds that are hanging around. These can cause problem
|
||||
* with backgrounded ssh processes started by ControlPersist.
|
||||
|
@ -977,6 +994,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" */
|
||||
|
|
Загрузка…
Ссылка в новой задаче