svn commit: r210616 - stable/8/bin/sh
Jilles Tjoelker
jilles at FreeBSD.org
Thu Jul 29 16:55:27 UTC 2010
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;
}
More information about the svn-src-stable-8
mailing list