From owner-svn-src-all@FreeBSD.ORG Sun Jun 6 22:27:33 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 024571065672; Sun, 6 Jun 2010 22:27:33 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E446E8FC15; Sun, 6 Jun 2010 22:27:32 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o56MRWdW072454; Sun, 6 Jun 2010 22:27:32 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o56MRWZL072452; Sun, 6 Jun 2010 22:27:32 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201006062227.o56MRWZL072452@svn.freebsd.org> From: Jilles Tjoelker Date: Sun, 6 Jun 2010 22:27:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r208881 - head/bin/sh X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Jun 2010 22:27:33 -0000 Author: jilles Date: Sun Jun 6 22:27:32 2010 New Revision: 208881 URL: http://svn.freebsd.org/changeset/base/208881 Log: sh: Pass through SIGINT from a child 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. MFC after: 1 month Modified: head/bin/sh/jobs.c Modified: head/bin/sh/jobs.c ============================================================================== --- head/bin/sh/jobs.c Sun Jun 6 21:19:04 2010 (r208880) +++ head/bin/sh/jobs.c Sun Jun 6 22:27:32 2010 (r208881) @@ -866,6 +866,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; @@ -903,6 +904,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; }