summaryrefslogtreecommitdiffstats
path: root/usr.bin/truss/main.c
diff options
context:
space:
mode:
authorsef <sef@FreeBSD.org>2000-01-10 04:09:05 +0000
committersef <sef@FreeBSD.org>2000-01-10 04:09:05 +0000
commit31b9ca1819116012a8cd7a78cce90b0820aac53e (patch)
treedf5ccadb71b85185101693e26b24562f864636cc /usr.bin/truss/main.c
parent3452c8e1b7ed8a214ae8748f449dd9363cee9920 (diff)
downloadFreeBSD-src-31b9ca1819116012a8cd7a78cce90b0820aac53e.zip
FreeBSD-src-31b9ca1819116012a8cd7a78cce90b0820aac53e.tar.gz
Handle the case where we truss an SUGID program -- in particular, we need
to wake up any processes waiting via PIOCWAIT on process exit, and truss needs to be more aware that a process may actually disappear while it's waiting. Reviewed by: Paul Saab <ps@yahoo-inc.com>
Diffstat (limited to 'usr.bin/truss/main.c')
-rw-r--r--usr.bin/truss/main.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/usr.bin/truss/main.c b/usr.bin/truss/main.c
index ab5c0ba..d09ee67 100644
--- a/usr.bin/truss/main.c
+++ b/usr.bin/truss/main.c
@@ -202,6 +202,9 @@ main(int ac, char **av) {
Procfd = start_tracing(pid, S_EXEC | S_SCE | S_SCX | S_CORE | S_EXIT |
(nosigs ? 0 : S_SIG));
+ if (Procfd == -1)
+ return 0;
+
pfs.why = 0;
funcs = set_etype();
@@ -251,8 +254,12 @@ main(int ac, char **av) {
break;
}
}
- if (ioctl(Procfd, PIOCCONT, val) == -1)
- warn("PIOCCONT");
+ if (ioctl(Procfd, PIOCCONT, val) == -1) {
+ if (kill(pid, 0) == -1 && errno == ESRCH)
+ break;
+ else
+ warn("PIOCCONT");
+ }
} while (pfs.why != S_EXIT);
fflush(outfile);
if (sigexit) {
OpenPOWER on IntegriCloud