projects
/
unix-history
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
tags
|
clone url
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
prevent interrupt and quit from killing parent while executing sub-commands
[unix-history]
/
usr
/
src
/
usr.bin
/
find
/
find.c
diff --git
a/usr/src/usr.bin/find/find.c
b/usr/src/usr.bin/find/find.c
index
8e035f0
..
20b1476
100644
(file)
--- 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 <stdio.h>
#include <sys/types.h>
/* find COMPILE: cc -o find -s -O -i find.c -lS */
#include <stdio.h>
#include <sys/types.h>
@@
-456,8
+456,14
@@
doex(com)
}
nargv[np] = 0;
if (np==0) return(9);
}
nargv[np] = 0;
if (np==0) return(9);
- if(fork()) /*parent*/ wait(&ccode);
- else { /*child*/
+ if(fork()) /*parent*/ {
+#include <signal.h>
+ 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);
chdir(Home);
execvp(nargv[0], nargv, np);
exit(1);