4 * This program gives Linux machines a reasonable secure way to boot single
5 * user. It forces the user to supply the root password before a shell is
6 * started. If there is a shadow password file and the encrypted root password
7 * is "x" the shadow password will be used.
9 * Copyright (C) 1998-2003 Miquel van Smoorenburg.
10 * Copyright (C) 2012 Karel Zak <kzak@redhat.com>
11 * Copyright (C) 2012 Werner Fink <werner@suse.de>
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 2 of the License, or
16 * (at your option) any later version.
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
23 * You should have received a copy of the GNU General Public License
24 * along with this program; if not, write to the Free Software
25 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
28 #include <sys/types.h>
42 #include <sys/ioctl.h>
47 #ifdef HAVE_LIBSELINUX
48 # include <selinux/selinux.h>
49 # include <selinux/get_context_list.h>
54 # include <sys/param.h>
58 #include "closestream.h"
60 #include "pathnames.h"
63 #include "sulogin-consoles.h"
66 static unsigned int timeout
;
68 static volatile uint32_t openfd
; /* Remember higher file descriptors */
69 static volatile uint32_t *usemask
;
71 struct sigaction saved_sigint
;
72 struct sigaction saved_sigtstp
;
73 struct sigaction saved_sigquit
;
74 struct sigaction saved_sighup
;
75 struct sigaction saved_sigchld
;
77 static volatile sig_atomic_t alarm_rised
;
78 static volatile sig_atomic_t sigchild
;
86 * For the case plymouth is found on this system
88 static int plymouth_command(const char* arg
)
90 const char *cmd
= "/usr/bin/plymouth";
91 static int has_plymouth
= 1;
99 int fd
= open("/dev/null", O_RDWR
);
106 execl(cmd
, cmd
, arg
, (char *) NULL
);
108 } else if (pid
> 0) {
110 waitpid(pid
, &status
, 0);
120 * Fix the tty modes and set reasonable defaults.
122 static void tcinit(struct console
*con
)
124 int mode
= 0, flags
= 0;
125 struct termios
*tio
= &con
->tio
;
128 #ifdef TIOCGLCKTRMIOS
129 int i
= (plymouth_command("--ping")) ? 20 : 0;
133 * With plymouth the termios flags become changed after this
134 * function had changed the termios.
136 memset(&lock
, 0, sizeof(struct termios
));
137 if (ioctl(fd
, TIOCGLCKTRMIOS
, &lock
) < 0)
139 if (!lock
.c_iflag
&& !lock
.c_oflag
&& !lock
.c_cflag
&& !lock
.c_lflag
)
141 if (i
== 15 && plymouth_command("quit") != 0)
145 memset(&lock
, 0, sizeof(struct termios
));
146 ioctl(fd
, TIOCSLCKTRMIOS
, &lock
);
151 if (tcgetattr(fd
, tio
) < 0) {
152 warn(_("tcgetattr failed"));
153 con
->flags
|= CON_NOTTY
;
157 /* Handle lines other than virtual consoles here */
158 #if defined(KDGKBMODE)
159 if (ioctl(fd
, KDGKBMODE
, &mode
) < 0)
162 speed_t ispeed
, ospeed
;
166 /* this is a modem line */
167 con
->flags
|= CON_SERIAL
;
169 /* Flush input and output queues on modem lines */
170 tcflush(fd
, TCIOFLUSH
);
172 ispeed
= cfgetispeed(tio
);
173 ospeed
= cfgetospeed(tio
);
175 if (!ispeed
) ispeed
= TTYDEF_SPEED
;
176 if (!ospeed
) ospeed
= TTYDEF_SPEED
;
178 tio
->c_cflag
= CREAD
| CS8
| HUPCL
| (tio
->c_cflag
& CLOCAL
);
181 tio
->c_oflag
&= OPOST
| ONLCR
;
183 cfsetispeed(tio
, ispeed
);
184 cfsetospeed(tio
, ospeed
);
186 #ifdef HAVE_STRUCT_TERMIOS_C_LINE
189 tio
->c_cc
[VTIME
] = 0;
192 if (ioctl(fd
, TIOCGWINSZ
, &ws
) == 0) {
194 if (ws
.ws_row
== 0) {
198 if (ws
.ws_col
== 0) {
203 ignore_result( ioctl(fd
, TIOCSWINSZ
, &ws
) );
206 setlocale(LC_CTYPE
, "POSIX");
209 #if defined(IUTF8) && defined(KDGKBMODE)
210 /* Handle mode of current keyboard setup, e.g. for UTF-8 */
213 setlocale(LC_CTYPE
, "C.UTF-8");
214 flags
|= UL_TTY_UTF8
;
220 setlocale(LC_CTYPE
, "POSIX");
224 setlocale(LC_CTYPE
, "POSIX");
226 reset_virtual_console(tio
, flags
);
228 if (tcsetattr(fd
, TCSANOW
, tio
))
229 warn(_("tcsetattr failed"));
231 /* Enable blocking mode for read and write */
232 if ((flags
= fcntl(fd
, F_GETFL
, 0)) != -1)
233 ignore_result( fcntl(fd
, F_SETFL
, flags
& ~O_NONBLOCK
) );
237 * Finalize the tty modes on modem lines.
239 static void tcfinal(struct console
*con
)
244 if ((con
->flags
& CON_SERIAL
) == 0) {
245 setenv("TERM", "linux", 1);
248 if (con
->flags
& CON_NOTTY
) {
249 setenv("TERM", "dumb", 1);
253 #if defined (__s390__) || defined (__s390x__)
254 setenv("TERM", "dumb", 1);
256 setenv("TERM", "vt102", 1);
261 tio
->c_iflag
|= (IXON
| IXOFF
);
262 tio
->c_lflag
|= (ICANON
| ISIG
| ECHO
|ECHOE
|ECHOK
|ECHOKE
);
263 tio
->c_oflag
|= OPOST
;
265 tio
->c_cc
[VINTR
] = CINTR
;
266 tio
->c_cc
[VQUIT
] = CQUIT
;
267 tio
->c_cc
[VERASE
] = con
->cp
.erase
;
268 tio
->c_cc
[VKILL
] = con
->cp
.kill
;
269 tio
->c_cc
[VEOF
] = CEOF
;
271 tio
->c_cc
[VSWTC
] = _POSIX_VDISABLE
;
272 #elif defined(VSWTCH)
273 tio
->c_cc
[VSWTCH
] = _POSIX_VDISABLE
;
275 tio
->c_cc
[VSTART
] = CSTART
;
276 tio
->c_cc
[VSTOP
] = CSTOP
;
277 tio
->c_cc
[VSUSP
] = CSUSP
;
278 tio
->c_cc
[VEOL
] = _POSIX_VDISABLE
;
280 if (con
->cp
.eol
== CR
) {
281 tio
->c_iflag
|= ICRNL
;
282 tio
->c_iflag
&= ~(INLCR
|IGNCR
);
283 tio
->c_oflag
|= ONLCR
;
284 tio
->c_oflag
&= ~(OCRNL
|ONLRET
);
287 switch (con
->cp
.parity
) {
290 tio
->c_cflag
&= ~(PARODD
| PARENB
);
291 tio
->c_iflag
&= ~(INPCK
| ISTRIP
);
293 case 1: /* odd parity */
294 tio
->c_cflag
|= PARODD
;
296 case 2: /* even parity */
297 tio
->c_cflag
|= PARENB
;
298 tio
->c_iflag
|= (INPCK
| ISTRIP
);
300 case (1 | 2): /* no parity bit */
301 tio
->c_cflag
&= ~CSIZE
;
306 /* Set line attributes */
307 tcsetattr(fd
, TCSANOW
, tio
);
313 static void alrm_handler(int sig
__attribute__((unused
)))
315 /* Timeout expired */
319 static void chld_handler(int sig
__attribute__((unused
)))
324 static void mask_signal(int signal
, void (*handler
)(int),
325 struct sigaction
*origaction
)
327 struct sigaction newaction
;
329 newaction
.sa_handler
= handler
;
330 sigemptyset(&newaction
.sa_mask
);
331 newaction
.sa_flags
= 0;
333 sigaction(signal
, &newaction
, origaction
);
336 static void unmask_signal(int signal
, struct sigaction
*sa
)
338 sigaction(signal
, sa
, NULL
);
342 * See if an encrypted password is valid. The encrypted password is checked for
343 * traditional-style DES and FreeBSD-style MD5 encryption.
345 static int valid(const char *pass
)
358 * up to 4 bytes for the signature e.g. $1$
360 for (s
= pass
+1; *s
&& *s
!= '$'; s
++);
365 if ((off
= (off_t
)(s
-pass
)) > 4 || off
< 3)
368 memset(id
, '\0', sizeof(id
));
369 strncpy(id
, pass
, off
);
372 * up to 16 bytes for the salt
374 for (; *s
&& *s
!= '$'; s
++);
379 if ((off_t
)(s
-pass
) > 16)
385 * the MD5 hash (128 bits or 16 bytes) encoded in base64 = 22 bytes
387 if ((strcmp(id
, "$1$") == 0) && (len
< 22 || len
> 24))
391 * the SHA-256 hash 43 bytes
393 if ((strcmp(id
, "$5$") == 0) && (len
< 42 || len
> 44))
397 * the SHA-512 hash 86 bytes
399 if ((strcmp(id
, "$6$") == 0) && (len
< 85 || len
> 87))
407 if (strlen(pass
) != 13)
410 for (s
= pass
; *s
; s
++) {
411 if ((*s
< '0' || *s
> '9') &&
412 (*s
< 'a' || *s
> 'z') &&
413 (*s
< 'A' || *s
> 'Z') &&
414 *s
!= '.' && *s
!= '/')
421 * Set a variable if the value is not NULL.
423 static inline void set(char **var
, char *val
)
430 * Get the root password entry.
432 static struct passwd
*getrootpwent(int try_manually
)
434 static struct passwd pwd
;
438 static char line
[256];
439 static char sline
[256];
443 * First, we try to get the password the standard way using normal
446 if ((pw
= getpwnam("root")) &&
447 !strcmp(pw
->pw_passwd
, "x") &&
448 (spw
= getspnam("root")))
449 pw
->pw_passwd
= spw
->sp_pwdp
;
451 if (pw
|| !try_manually
)
455 * If we come here, we could not retrieve the root password through
456 * library calls and we try to read the password and shadow files
459 pwd
.pw_name
= "root";
461 pwd
.pw_gecos
= "Super User";
467 if ((fp
= fopen(_PATH_PASSWD
, "r")) == NULL
) {
468 warn(_("cannot open %s"), _PATH_PASSWD
);
473 * Find root in the password file.
475 while ((p
= fgets(line
, 256, fp
)) != NULL
) {
476 if (strncmp(line
, "root:", 5) != 0)
479 set(&pwd
.pw_passwd
, strsep(&p
, ":"));
482 set(&pwd
.pw_gecos
, strsep(&p
, ":"));
483 set(&pwd
.pw_dir
, strsep(&p
, ":"));
484 set(&pwd
.pw_shell
, strsep(&p
, "\n"));
492 * If the encrypted password is valid or not found, return.
495 warnx(_("%s: no entry for root\n"), _PATH_PASSWD
);
498 if (valid(pwd
.pw_passwd
))
502 * The password is invalid. If there is a shadow password, try it.
504 strcpy(pwd
.pw_passwd
, "");
505 if ((fp
= fopen(_PATH_SHADOW_PASSWD
, "r")) == NULL
) {
506 warn(_("cannot open %s"), _PATH_PASSWD
);
509 while ((p
= fgets(sline
, 256, fp
)) != NULL
) {
510 if (strncmp(sline
, "root:", 5) != 0)
513 set(&pwd
.pw_passwd
, strsep(&p
, ":"));
519 * If the password is still invalid, NULL it, and return.
522 warnx(_("%s: no entry for root"), _PATH_SHADOW_PASSWD
);
523 strcpy(pwd
.pw_passwd
, "");
525 if (!valid(pwd
.pw_passwd
)) {
526 warnx(_("%s: root password garbled"), _PATH_SHADOW_PASSWD
);
527 strcpy(pwd
.pw_passwd
, "");
533 * Ask by prompt for the password.
535 static void doprompt(const char *crypted
, struct console
*con
)
539 if (con
->flags
& CON_SERIAL
) {
542 * For prompting: map NL in output to CR-NL
543 * otherwise we may see stairs in the output.
545 tty
.c_oflag
|= (ONLCR
| OPOST
);
546 tcsetattr(con
->fd
, TCSADRAIN
, &tty
);
548 if (con
->file
== (FILE*)0) {
549 if ((con
->file
= fdopen(con
->fd
, "r+")) == (FILE*)0)
552 #if defined(USE_ONELINE)
554 fprintf(con
->file
, _("Give root password for login: "));
556 fprintf(con
->file
, _("Press Enter for login: "));
559 fprintf(con
->file
, _("Give root password for maintenance\n"));
561 fprintf(con
->file
, _("Press Enter for maintenance"));
562 fprintf(con
->file
, _("(or press Control-D to continue): "));
566 if (con
->flags
& CON_SERIAL
)
567 tcsetattr(con
->fd
, TCSADRAIN
, &con
->tio
);
571 * Make sure to have an own session and controlling terminal
573 static void setup(struct console
*con
)
575 pid_t pid
, pgrp
, ppgrp
, ttypgrp
;
578 if (con
->flags
& CON_NOTTY
)
583 * Only go through this trouble if the new
584 * tty doesn't fall in this process group.
588 ppgrp
= getpgid(getppid());
589 ttypgrp
= tcgetpgrp(fd
);
591 if (pgrp
!= ttypgrp
&& ppgrp
!= ttypgrp
) {
592 if (pid
!= getsid(0)) {
593 if (pid
== getpgid(0))
594 setpgid(0, getpgid(getppid()));
598 mask_signal(SIGHUP
, SIG_IGN
, &saved_sighup
);
600 ioctl(STDIN_FILENO
, TIOCNOTTY
, (char *)1);
601 unmask_signal(SIGHUP
, &saved_sighup
);
602 if (fd
> STDIN_FILENO
) close(STDIN_FILENO
);
603 if (fd
> STDOUT_FILENO
) close(STDOUT_FILENO
);
604 if (fd
> STDERR_FILENO
) close(STDERR_FILENO
);
606 ioctl(fd
, TIOCSCTTY
, (char *)1);
607 tcsetpgrp(fd
, ppgrp
);
609 dup2(fd
, STDIN_FILENO
);
610 dup2(fd
, STDOUT_FILENO
);
611 dup2(fd
, STDERR_FILENO
);
612 con
->fd
= STDIN_FILENO
;
614 for (fd
= STDERR_FILENO
+1; fd
< 32; fd
++) {
615 if (openfd
& (1<<fd
)) {
623 * Ask for the password. Note that there is no default timeout as we normally
624 * skip this during boot.
626 static char *getpasswd(struct console
*con
)
630 static char pass
[128], *ptr
;
638 if (con
->flags
& CON_NOTTY
)
644 tty
.c_iflag
&= ~(IUCLC
|IXON
|IXOFF
|IXANY
);
645 tty
.c_lflag
&= ~(ECHO
|ECHOE
|ECHOK
|ECHONL
|TOSTOP
|ISIG
);
646 tc
= (tcsetattr(fd
, TCSAFLUSH
, &tty
) == 0);
648 sigemptyset(&sa
.sa_mask
);
649 sa
.sa_handler
= alrm_handler
;
651 sigaction(SIGALRM
, &sa
, NULL
);
657 cp
->eol
= *ptr
= '\0';
659 eightbit
= ((con
->flags
& CON_SERIAL
) == 0 || (tty
.c_cflag
& (PARODD
|PARENB
)) == 0);
660 while (cp
->eol
== '\0') {
661 if (read(fd
, &c
, 1) < 1) {
662 if (errno
== EINTR
|| errno
== EAGAIN
) {
675 warn(_("cannot read %s"), con
->tty
);
683 else if (c
!= (ascval
= (c
& 0177))) {
685 for (bits
= 1, mask
= 1; mask
& 0177; mask
<<= 1) {
689 cp
->parity
|= ((bits
& 1) ? 1 : 2);
709 while (ptr
> &pass
[0])
715 if ((size_t)(ptr
- &pass
[0]) >= (sizeof(pass
) -1 )) {
716 fprintf(stderr
, "sulogin: input overrun at %s\n\r", con
->tty
);
727 tcsetattr(fd
, TCSAFLUSH
, &con
->tio
);
728 if (ret
&& *ret
!= '\0')
736 * Password was OK, execute a shell.
738 static void sushell(struct passwd
*pwd
)
740 char shell
[PATH_MAX
];
746 * Set directory and shell.
748 if (chdir(pwd
->pw_dir
) != 0) {
749 warn(_("%s: change directory failed"), pwd
->pw_dir
);
750 printf(_("Logging in with home = \"/\".\n"));
753 warn(_("change directory to system root failed"));
756 if ((p
= getenv("SUSHELL")) != NULL
)
758 else if ((p
= getenv("sushell")) != NULL
)
761 if (pwd
->pw_shell
[0])
762 su_shell
= pwd
->pw_shell
;
764 su_shell
= "/bin/sh";
766 if ((p
= strrchr(su_shell
, '/')) == NULL
)
771 snprintf(shell
, sizeof(shell
), profile
? "-%s" : "%s", p
);
774 * Set some important environment variables.
776 if (getcwd(home
, sizeof(home
)) == NULL
)
779 setenv("HOME", home
, 1);
780 setenv("LOGNAME", "root", 1);
781 setenv("USER", "root", 1);
783 setenv("SHLVL","0",1);
786 * Try to execute a shell.
788 setenv("SHELL", su_shell
, 1);
789 unmask_signal(SIGINT
, &saved_sigint
);
790 unmask_signal(SIGTSTP
, &saved_sigtstp
);
791 unmask_signal(SIGQUIT
, &saved_sigquit
);
792 mask_signal(SIGHUP
, SIG_DFL
, NULL
);
794 #ifdef HAVE_LIBSELINUX
795 if (is_selinux_enabled() > 0) {
796 security_context_t scon
=NULL
;
799 if (getseuserbyname("root", &seuser
, &level
) == 0) {
800 if (get_default_context_with_level(seuser
, level
, 0, &scon
) == 0) {
801 if (setexeccon(scon
) != 0)
802 warnx(_("setexeccon failed"));
810 execl(su_shell
, shell
, NULL
);
811 warn(_("failed to execute %s"), su_shell
);
813 setenv("SHELL", "/bin/sh", 1);
814 execl("/bin/sh", profile
? "-sh" : "sh", NULL
);
815 warn(_("failed to execute %s"), "/bin/sh");
818 static void usage(FILE *out
)
820 fputs(USAGE_HEADER
, out
);
822 " %s [options] [tty device]\n"), program_invocation_short_name
);
824 fputs(USAGE_SEPARATOR
, out
);
825 fputs(_("Single-user login.\n"), out
);
827 fputs(USAGE_OPTIONS
, out
);
828 fputs(_(" -p, --login-shell start a login shell\n"
829 " -t, --timeout <seconds> max time to wait for a password (default: no limit)\n"
830 " -e, --force examine password files directly if getpwnam(3) fails\n"),
833 fputs(USAGE_SEPARATOR
, out
);
834 fputs(USAGE_HELP
, out
);
835 fputs(USAGE_VERSION
, out
);
836 fprintf(out
, USAGE_MAN_TAIL("sulogin(8)"));
839 int main(int argc
, char **argv
)
842 struct list_head
*ptr
;
851 static const struct option longopts
[] = {
852 { "login-shell", 0, 0, 'p' },
853 { "timeout", 1, 0, 't' },
854 { "force", 0, 0, 'e' },
855 { "help", 0, 0, 'h' },
856 { "version", 0, 0, 'V' },
861 * If we are init we need to set up a own session.
863 if ((pid
= getpid()) == 1) {
865 ignore_result( ioctl(STDIN_FILENO
, TIOCSCTTY
, (char *) 1) );
868 setlocale(LC_ALL
, "");
869 bindtextdomain(PACKAGE
, LOCALEDIR
);
871 atexit(close_stdout
); /* XXX */
874 * See if we have a timeout flag.
876 while ((c
= getopt_long(argc
, argv
, "ehpt:V", longopts
, NULL
)) != -1) {
879 timeout
= strtou32_or_err(optarg
, _("invalid timeout argument"));
888 printf(UTIL_LINUX_VERSION
);
901 errx(EXIT_FAILURE
, _("only superuser can run this program"));
903 mask_signal(SIGQUIT
, SIG_IGN
, &saved_sigquit
);
904 mask_signal(SIGTSTP
, SIG_IGN
, &saved_sigtstp
);
905 mask_signal(SIGINT
, SIG_IGN
, &saved_sigint
);
906 mask_signal(SIGHUP
, SIG_IGN
, &saved_sighup
);
909 emergency_do_mounts();
910 atexit( emergency_do_umounts
);
913 * See if we need to open an other tty device.
918 if (!tty
|| *tty
== '\0')
919 tty
= getenv("CONSOLE");
922 * Detect possible consoles, use stdin as fallback.
923 * If an optional tty is given, reconnect it to stdin.
925 reconnect
= detect_consoles(tty
, STDIN_FILENO
, &consoles
);
928 * If previous stdin was not the speified tty and therefore reconnected
929 * to the specified tty also reconnect stdout and stderr.
932 if (isatty(STDOUT_FILENO
) == 0)
933 dup2(STDOUT_FILENO
, STDIN_FILENO
);
934 if (isatty(STDERR_FILENO
) == 0)
935 dup2(STDOUT_FILENO
, STDERR_FILENO
);
941 if (list_empty(&consoles
)) {
944 err(EXIT_FAILURE
, _("cannot open console"));
948 * Get the root password.
950 if ((pwd
= getrootpwent(opt_e
)) == NULL
) {
951 warnx(_("cannot open password database"));
957 * Ask for the password on the consoles.
959 list_for_each(ptr
, &consoles
) {
960 con
= list_entry(ptr
, struct console
, entry
);
961 if (con
->id
>= CONMAX
)
964 openfd
|= (1 << con
->fd
);
968 if ((con
->fd
= open(con
->tty
, O_RDWR
| O_NOCTTY
| O_NONBLOCK
)) < 0)
970 openfd
|= (1 << con
->fd
);
973 ptr
= (&consoles
)->next
;
974 usemask
= (uint32_t*) mmap(NULL
, sizeof(uint32_t),
975 PROT_READ
|PROT_WRITE
,
976 MAP_ANONYMOUS
|MAP_SHARED
, -1, 0);
978 if (ptr
->next
== &consoles
) {
979 con
= list_entry(ptr
, struct console
, entry
);
983 mask_signal(SIGCHLD
, chld_handler
, &saved_sigchld
);
985 con
= list_entry(ptr
, struct console
, entry
);
986 if (con
->id
>= CONMAX
)
989 switch ((con
->pid
= fork())) {
991 mask_signal(SIGCHLD
, SIG_DFL
, NULL
);
996 const char *passwd
= pwd
->pw_passwd
;
998 int failed
= 0, doshell
= 0;
1000 doprompt(passwd
, con
);
1001 if ((answer
= getpasswd(con
)) == NULL
)
1004 if (passwd
[0] == '\0')
1007 const char *cryptbuf
;
1008 cryptbuf
= crypt(answer
, passwd
);
1009 if (cryptbuf
== NULL
)
1010 warn(_("crypt failed"));
1011 else if (strcmp(cryptbuf
, pwd
->pw_passwd
) == 0)
1016 *usemask
|= (1<<con
->id
);
1018 *usemask
&= ~(1<<con
->id
);
1022 mask_signal(SIGQUIT
, SIG_IGN
, &saved_sigquit
);
1023 mask_signal(SIGTSTP
, SIG_IGN
, &saved_sigtstp
);
1024 mask_signal(SIGINT
, SIG_IGN
, &saved_sigint
);
1027 fprintf(stderr
, _("Can not execute su shell\n\n"));
1030 fprintf(stderr
, _("Login incorrect\n\n"));
1034 warnx(_("Timed out\n\n"));
1037 * User pressed Control-D.
1041 warn(_("fork failed"));
1049 } while (ptr
!= &consoles
);
1051 while ((pid
= wait(&status
))) {
1052 if (errno
== ECHILD
)
1056 list_for_each(ptr
, &consoles
) {
1057 con
= list_entry(ptr
, struct console
, entry
);
1058 if (con
->pid
== pid
) {
1059 *usemask
&= ~(1<<con
->id
);
1062 if (kill(con
->pid
, 0) < 0) {
1063 *usemask
&= ~(1<<con
->id
);
1066 if (*usemask
& (1<<con
->id
))
1068 kill(con
->pid
, SIGHUP
);
1070 kill(con
->pid
, SIGKILL
);
1074 mask_signal(SIGCHLD
, SIG_DFL
, NULL
);
1075 return EXIT_SUCCESS
;