summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>2014-05-24 17:04:16 +0000
committerderaadt <deraadt@openbsd.org>2014-05-24 17:04:16 +0000
commitd57dd2f7160ed46b60baa598f43e5703144a0e2b (patch)
tree2e5e8d55a7f20f12482451f91992a29e8e4c473c
parentUse C99 initialisers for SSL3_ENC_METHOD structs. (diff)
downloadwireguard-openbsd-d57dd2f7160ed46b60baa598f43e5703144a0e2b.tar.xz
wireguard-openbsd-d57dd2f7160ed46b60baa598f43e5703144a0e2b.zip
when ktrace() return ESRCH, the error is regarding the pid, not the pathname
ok miod
-rw-r--r--usr.bin/ktrace/ktrace.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/usr.bin/ktrace/ktrace.c b/usr.bin/ktrace/ktrace.c
index bd7b8cc7310..d73a0b0bebe 100644
--- a/usr.bin/ktrace/ktrace.c
+++ b/usr.bin/ktrace/ktrace.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ktrace.c,v 1.29 2014/04/07 21:42:56 jmc Exp $ */
+/* $OpenBSD: ktrace.c,v 1.30 2014/05/24 17:04:16 deraadt Exp $ */
/* $NetBSD: ktrace.c,v 1.4 1995/08/31 23:01:44 jtc Exp $ */
/*-
@@ -161,8 +161,11 @@ main(int argc, char *argv[])
} else
ops |= pid ? KTROP_CLEAR : KTROP_CLEARFILE;
- if (ktrace(tracefile, ops, trpoints, pid) < 0)
+ if (ktrace(tracefile, ops, trpoints, pid) < 0) {
+ if (errno == ESRCH)
+ err(1, "%d", pid);
err(1, "%s", tracefile);
+ }
exit(0);
}
@@ -196,8 +199,11 @@ main(int argc, char *argv[])
execvp(argv[0], &argv[0]);
err(1, "exec of '%s' failed", argv[0]);
}
- else if (ktrace(tracefile, ops, trpoints, pid) < 0)
+ else if (ktrace(tracefile, ops, trpoints, pid) < 0) {
+ if (errno == ESRCH)
+ err(1, "%d", pid);
err(1, "%s", tracefile);
+ }
exit(0);
}