From 7f2b31d90ceabd3ecaa456bef0eb015f5cca0311 Mon Sep 17 00:00:00 2001 From: Bill Joy Date: Sat, 4 Jul 1981 06:19:52 -0800 Subject: [PATCH] prevent interrupt and quit from killing parent while executing sub-commands SCCS-vsn: usr.bin/find/find.c 4.3 --- usr/src/usr.bin/find/find.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/usr/src/usr.bin/find/find.c b/usr/src/usr.bin/find/find.c index 8e035f0f95..20b1476e2a 100644 --- a/usr/src/usr.bin/find/find.c +++ b/usr/src/usr.bin/find/find.c @@ -1,4 +1,4 @@ -static char *sccsid = "@(#)find.c 4.2 (Berkeley) %G%"; +static char *sccsid = "@(#)find.c 4.3 (Berkeley) %G%"; /* find COMPILE: cc -o find -s -O -i find.c -lS */ #include #include @@ -456,8 +456,14 @@ doex(com) } nargv[np] = 0; if (np==0) return(9); - if(fork()) /*parent*/ wait(&ccode); - else { /*child*/ + if(fork()) /*parent*/ { +#include + int (*old)() = signal(SIGINT, SIG_IGN); + int (*oldq)() = signal(SIGQUIT, SIG_IGN); + wait(&ccode); + signal(SIGINT, old); + signal(SIGQUIT, oldq); + } else { /*child*/ chdir(Home); execvp(nargv[0], nargv, np); exit(1); -- 2.20.1