From owner-svn-src-head@freebsd.org Sat Apr 22 21:31:38 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CC905D4B95F; Sat, 22 Apr 2017 21:31:38 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9E72EB54; Sat, 22 Apr 2017 21:31:38 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3MLVbX1097762; Sat, 22 Apr 2017 21:31:37 GMT (envelope-from jilles@FreeBSD.org) Received: (from jilles@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3MLVb6k097759; Sat, 22 Apr 2017 21:31:37 GMT (envelope-from jilles@FreeBSD.org) Message-Id: <201704222131.v3MLVb6k097759@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jilles set sender to jilles@FreeBSD.org using -f From: Jilles Tjoelker Date: Sat, 22 Apr 2017 21:31:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317298 - head/bin/sh X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Apr 2017 21:31:38 -0000 Author: jilles Date: Sat Apr 22 21:31:37 2017 New Revision: 317298 URL: https://svnweb.freebsd.org/changeset/base/317298 Log: sh: Simplify setinteractive(). setsignal() does nothing if the signal disposition is already set correctly. Modified: head/bin/sh/options.c head/bin/sh/trap.c head/bin/sh/trap.h Modified: head/bin/sh/options.c ============================================================================== --- head/bin/sh/options.c Sat Apr 22 21:26:15 2017 (r317297) +++ head/bin/sh/options.c Sat Apr 22 21:31:37 2017 (r317298) @@ -131,7 +131,7 @@ procargs(int argc, char **argv) void optschanged(void) { - setinteractive(iflag); + setinteractive(); #ifndef NO_HISTORY histedit(); #endif Modified: head/bin/sh/trap.c ============================================================================== --- head/bin/sh/trap.c Sat Apr 22 21:26:15 2017 (r317297) +++ head/bin/sh/trap.c Sat Apr 22 21:31:37 2017 (r317298) @@ -478,19 +478,14 @@ dotrap(void) /* - * Controls whether the shell is interactive or not. + * Controls whether the shell is interactive or not based on iflag. */ void -setinteractive(int on) +setinteractive(void) { - static int is_interactive = -1; - - if (on == is_interactive) - return; setsignal(SIGINT); setsignal(SIGQUIT); setsignal(SIGTERM); - is_interactive = on; } Modified: head/bin/sh/trap.h ============================================================================== --- head/bin/sh/trap.h Sat Apr 22 21:26:15 2017 (r317297) +++ head/bin/sh/trap.h Sat Apr 22 21:31:37 2017 (r317298) @@ -43,6 +43,6 @@ void ignoresig(int); int issigchldtrapped(void); void onsig(int); void dotrap(void); -void setinteractive(int); +void setinteractive(void); void exitshell(int) __dead2; void exitshell_savedstatus(void) __dead2;