From owner-freebsd-current Tue May 28 20:26:17 2002 Delivered-To: freebsd-current@freebsd.org Received: from h132-197-179-27.gte.com (h132-197-179-27.gte.com [132.197.179.27]) by hub.freebsd.org (Postfix) with ESMTP id E401037B400; Tue, 28 May 2002 20:26:12 -0700 (PDT) Received: from kanpc.gte.com (localhost [IPv6:::1]) by h132-197-179-27.gte.com (8.12.3/8.12.3) with ESMTP id g4T3Q4fS012493; Tue, 28 May 2002 23:26:04 -0400 (EDT) (envelope-from ak03@kanpc.gte.com) Received: (from ak03@localhost) by kanpc.gte.com (8.12.3/8.12.3/Submit) id g4T3Q4CP012492; Tue, 28 May 2002 23:26:04 -0400 (EDT) Date: Tue, 28 May 2002 23:26:04 -0400 From: Alexander Kabaev To: Jos Backus Cc: Bruce Evans , freebsd-current@FreeBSD.ORG, des@FreeBSD.ORG Subject: Re: zsh exits upon ^C after su'ing to root with zsh as its shell Message-ID: <20020529032604.GA12450@kanpc.gte.com> References: <20020528224503.GE11876@lizzy.catnook.com> <20020529105048.W23368-100000@gamplex.bde.org> <20020529030006.GB22504@lizzy.catnook.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20020529030006.GB22504@lizzy.catnook.com> User-Agent: Mutt/1.3.99i Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG > > Thanks Bruce. It sounds like we'll have to live with this problem for now? > For the lack of better ideas, I am just reposting the patch I sent to Bruce about one year ago. I have been happily using it on all my systems since then. Index: su.c =================================================================== RCS file: /usr/ncvs/src/usr.bin/su/su.c,v retrieving revision 1.50 diff -u -r1.50 su.c --- su.c 28 May 2002 06:47:32 -0000 1.50 +++ su.c 28 May 2002 08:43:04 -0000 @@ -132,6 +132,8 @@ 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 @@ * 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 @@ 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 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message