aboutsummaryrefslogtreecommitdiff
path: root/usr.bin/truss/setup.c
diff options
context:
space:
mode:
authorSean Eric Fagan <sef@FreeBSD.org>2000-01-10 04:09:05 +0000
committerSean Eric Fagan <sef@FreeBSD.org>2000-01-10 04:09:05 +0000
commit893618352c9569f73cc299ebae2c18f7a1ac17bc (patch)
tree0fafa798b2f0afc13705fecfc830b961db6440dc /usr.bin/truss/setup.c
parent9090c22ce7e7c50d825ae85a9968d852b0958cdc (diff)
Notes
Diffstat (limited to 'usr.bin/truss/setup.c')
-rw-r--r--usr.bin/truss/setup.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/usr.bin/truss/setup.c b/usr.bin/truss/setup.c
index afa011308e937..5af1fabbf01d6 100644
--- a/usr.bin/truss/setup.c
+++ b/usr.bin/truss/setup.c
@@ -133,8 +133,16 @@ start_tracing(int pid, int flags) {
sprintf(buf, "/proc/%d/mem", pid);
fd = open(buf, O_RDWR);
- if (fd == -1)
+ if (fd == -1) {
+ /*
+ * The process may have run away before we could start -- this
+ * happens with SUGID programs. So we need to see if it still
+ * exists before we complain bitterly.
+ */
+ if (kill(pid, 0) == -1)
+ return -1;
err(8, "cannot open %s", buf);
+ }
if (ioctl(fd, PIOCSTATUS, &tmp) == -1) {
err(10, "cannot get procfs status struct");