|
|
1.1 root 1: *** find.c.orig Fri Aug 16 18:55:48 1985
2: --- find.c Fri Aug 16 18:57:09 1985
3: ***************
4: *** 551,557 ****
5: register char *na;
6: static char *nargv[50];
7: static ccode;
8: ! register int w, pid, (*sigint)(), (*sigquit)(), cantexec;
9:
10: ccode = np = 0;
11: while (na=Argv[com++]) {
12: --- 551,557 ----
13: register char *na;
14: static char *nargv[50];
15: static ccode;
16: ! register int w, pid, omask;
17:
18: ccode = np = 0;
19: while (na=Argv[com++]) {
20: ***************
21: *** 562,572 ****
22: }
23: nargv[np] = 0;
24: if (np==0) return(9);
25: - /*
26: - * This is a kludge, but the alternative is to reserve
27: - * some exit code (e.g. 0xff) to denote inability to exec.
28: - */
29: - cantexec = 0;
30: switch (pid = vfork()) {
31: case -1:
32: perror("find: Can't fork");
33: --- 562,567 ----
34: ***************
35: *** 576,597 ****
36: case 0:
37: chdir(Home);
38: execvp(nargv[0], nargv, np);
39: ! cantexec = 1; /* XXX */
40: ! _exit(1);
41: break;
42:
43: default:
44: ! sigint = signal(SIGINT, SIG_IGN);
45: ! sigquit = signal(SIGQUIT, SIG_IGN);
46: while ((w = wait(&ccode)) != pid && w != -1)
47: ;
48: ! signal(SIGQUIT, sigquit);
49: ! signal(SIGINT, sigint);
50: ! if (cantexec) { /* XXX */
51: ! fprintf(stderr, "find: Can't execute ");
52: ! perror(nargv[0]);
53: exit(1);
54: - }
55: return (ccode != 0 ? 0 : 1);
56: }
57: }
58: --- 571,592 ----
59: case 0:
60: chdir(Home);
61: execvp(nargv[0], nargv, np);
62: ! write(2, "find: Can't execute ", 20);
63: ! _perror(nargv[0]);
64: ! /*
65: ! * Kill ourselves; our exit status will be a suicide
66: ! * note indicating we couldn't do the "exec".
67: ! */
68: ! kill(getpid(), SIGUSR1);
69: break;
70:
71: default:
72: ! omask = sigblock(sigmask(SIGINT)|sigmask(SIGQUIT));
73: while ((w = wait(&ccode)) != pid && w != -1)
74: ;
75: ! (void) sigsetmask(omask);
76: ! if ((ccode & 0177) == SIGUSR1)
77: exit(1);
78: return (ccode != 0 ? 0 : 1);
79: }
80: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.