Date: Thu, 29 Jul 2010 16:55:27 +0000 (UTC) From: Jilles Tjoelker <jilles@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r210616 - stable/8/bin/sh Message-ID: <201007291655.o6TGtR0k099119@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jilles Date: Thu Jul 29 16:55:27 2010 New Revision: 210616 URL: http://svn.freebsd.org/changeset/base/210616 Log: MFC r208881: sh: Pass through SIGINT if interactive and job control is enabled. This already worked if without job control. In either case, this depends on it that a process that terminates due to SIGINT exits on it (so not with status 1, or worse, 0). Example: sleep 5; echo continued This does not print "continued" any more if sleep is aborted via ctrl+c. Modified: stable/8/bin/sh/jobs.c Directory Properties: stable/8/bin/sh/ (props changed) Modified: stable/8/bin/sh/jobs.c ============================================================================== --- stable/8/bin/sh/jobs.c Thu Jul 29 16:49:20 2010 (r210615) +++ stable/8/bin/sh/jobs.c Thu Jul 29 16:55:27 2010 (r210616) @@ -862,6 +862,7 @@ waitforjob(struct job *jp, int *origstat { #if JOBS pid_t mypgrp = getpgrp(); + int propagate_int = jp->jobctl && jp->foreground; #endif int status; int st; @@ -899,6 +900,11 @@ waitforjob(struct job *jp, int *origstat else CLEAR_PENDING_INT; } +#if JOBS + else if (rootshell && iflag && propagate_int && + WIFSIGNALED(status) && WTERMSIG(status) == SIGINT) + kill(getpid(), SIGINT); +#endif INTON; return st; }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201007291655.o6TGtR0k099119>