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;
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to