This is Alexander Kabaev's patch to solve the signal problem with su

(see 'zsh exits upon ^C' thread).  This may be temporary be he's been
running it for a year without incident so we should be golden with it.

Approved by:	des
This commit is contained in:
Matthew Dillon 2002-06-26 00:42:40 +00:00
parent 6592cfde7a
commit b22ac97b33
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=98837

View File

@ -132,6 +132,8 @@ main(int argc, char *argv[])
char *username, *cleanenv, *class, shellbuf[MAXPATHLEN];
const char *p, *user, *shell, *mytty, **nargv;
struct sigaction sa, sa_int, sa_quit, sa_tstp;
shell = class = cleanenv = NULL;
asme = asthem = fastlogin = statusp = 0;
user = "root";
@ -314,6 +316,12 @@ main(int argc, char *argv[])
* We must fork() before setuid() because we need to call
* pam_setcred(pamh, PAM_DELETE_CRED) as root.
*/
sa.sa_flags = SA_RESTART;
sa.__sigaction_u.__sa_handler = SIG_IGN;
sigemptyset(&sa.sa_mask);
sigaction(SIGINT, &sa, &sa_int);
sigaction(SIGQUIT, &sa, &sa_quit);
sigaction(SIGTSTP, &sa, &sa_tstp);
statusp = 1;
child_pid = fork();
@ -339,6 +347,9 @@ main(int argc, char *argv[])
PAM_END();
exit(1);
case 0:
sigaction(SIGINT, &sa_int, NULL);
sigaction(SIGQUIT, &sa_quit, NULL);
sigaction(SIGTSTP, &sa_tstp, NULL);
/*
* Set all user context except for: Environmental variables
* Umask Login records (wtmp, etc) Path