|
Lines 230-241
main(int ac, char **av)
Link Here
|
| 230 |
struct servent *sp; |
230 |
struct servent *sp; |
| 231 |
Forward fwd; |
231 |
Forward fwd; |
| 232 |
|
232 |
|
| 233 |
/* Ensure that fds 0, 1 and 2 are open or directed to /dev/null */ |
|
|
| 234 |
sanitise_stdfd(); |
| 235 |
|
| 236 |
__progname = ssh_get_progname(av[0]); |
233 |
__progname = ssh_get_progname(av[0]); |
| 237 |
init_rng(); |
234 |
init_rng(); |
| 238 |
|
235 |
|
|
|
236 |
#ifndef HAVE_SETPROCTITLE |
| 237 |
/* Prepare for later setproctitle emulation */ |
| 238 |
{ |
| 239 |
/* Save argv. Duplicate so setproctitle emulation doesn't clobber it */ |
| 240 |
char **saved_argv = xcalloc(ac + 1, sizeof(*saved_argv)); |
| 241 |
for (i = 0; i < ac; i++) |
| 242 |
saved_argv[i] = xstrdup(av[i]); |
| 243 |
saved_argv[i] = NULL; |
| 244 |
compat_init_setproctitle(ac, av); |
| 245 |
av = saved_argv; |
| 246 |
} |
| 247 |
#endif |
| 248 |
|
| 249 |
/* Ensure that fds 0, 1 and 2 are open or directed to /dev/null */ |
| 250 |
sanitise_stdfd(); |
| 251 |
|
| 239 |
/* |
252 |
/* |
| 240 |
* Discard other fds that are hanging around. These can cause problem |
253 |
* Discard other fds that are hanging around. These can cause problem |
| 241 |
* with backgrounded ssh processes started by ControlPersist. |
254 |
* with backgrounded ssh processes started by ControlPersist. |
|
Lines 1046-1051
control_persist_detach(void)
Link Here
|
| 1046 |
/* muxclient() doesn't return on success. */ |
1059 |
/* muxclient() doesn't return on success. */ |
| 1047 |
fatal("Failed to connect to new control master"); |
1060 |
fatal("Failed to connect to new control master"); |
| 1048 |
} |
1061 |
} |
|
|
1062 |
chdir("/"); |
| 1049 |
if ((devnull = open(_PATH_DEVNULL, O_RDWR)) == -1) { |
1063 |
if ((devnull = open(_PATH_DEVNULL, O_RDWR)) == -1) { |
| 1050 |
error("%s: open(\"/dev/null\"): %s", __func__, |
1064 |
error("%s: open(\"/dev/null\"): %s", __func__, |
| 1051 |
strerror(errno)); |
1065 |
strerror(errno)); |
|
Lines 1056-1061
control_persist_detach(void)
Link Here
|
| 1056 |
if (devnull > STDERR_FILENO) |
1070 |
if (devnull > STDERR_FILENO) |
| 1057 |
close(devnull); |
1071 |
close(devnull); |
| 1058 |
} |
1072 |
} |
|
|
1073 |
setproctitle("%s [mux]", options.control_path); |
| 1059 |
} |
1074 |
} |
| 1060 |
|
1075 |
|
| 1061 |
/* Do fork() after authentication. Used by "ssh -f" */ |
1076 |
/* Do fork() after authentication. Used by "ssh -f" */ |
| 1062 |
- |
|
|