summaryrefslogtreecommitdiffstats
path: root/usr.bin
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2011-02-15 12:42:18 +0000
committerjhb <jhb@FreeBSD.org>2011-02-15 12:42:18 +0000
commit6190d8e2a6dec7a9ceca17a8a097edf734d595a7 (patch)
tree1a3489e39f252ff2b69d05255a405f395ea0917c /usr.bin
parentd20e0514a9bbaa474f28ba4e7acdcd82eb34d41d (diff)
downloadFreeBSD-src-6190d8e2a6dec7a9ceca17a8a097edf734d595a7.zip
FreeBSD-src-6190d8e2a6dec7a9ceca17a8a097edf734d595a7.tar.gz
Properly check for errors from waitpid().
Submitted by: gcooper MFC after: 1 week
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/truss/setup.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/usr.bin/truss/setup.c b/usr.bin/truss/setup.c
index bf23ec7..42c8235 100644
--- a/usr.bin/truss/setup.c
+++ b/usr.bin/truss/setup.c
@@ -83,7 +83,7 @@ setup_and_wait(char *command[])
}
/* Only in the parent here */
- if (waitpid(pid, &waitval, 0) < -1) {
+ if (waitpid(pid, &waitval, 0) < 0) {
err(1, "unexpect stop in waitpid");
return 0;
}
@@ -114,7 +114,7 @@ start_tracing(int pid)
err(1, "can not attach to target process");
child_pid = pid;
- if (waitpid(pid, &waitval, 0) < -1)
+ if (waitpid(pid, &waitval, 0) < 0)
err(1, "Unexpect stop in waitpid");
return (0);
@@ -133,7 +133,7 @@ restore_proc(int signo __unused)
/* stop the child so that we can detach */
kill(child_pid, SIGSTOP);
- if (waitpid(child_pid, &waitval, 0) < -1)
+ if (waitpid(child_pid, &waitval, 0) < 0)
err(1, "Unexpected stop in waitpid");
if (ptrace(PT_DETACH, child_pid, (caddr_t)1, 0) < 0)
@@ -183,7 +183,7 @@ waitevent(struct trussinfo *info)
ptrace(PT_SYSCALL, info->pid, (caddr_t)1, pending_signal);
pending_signal = 0;
- if (waitpid(info->pid, &waitval, 0) < -1) {
+ if (waitpid(info->pid, &waitval, 0) < 0) {
err(1, "Unexpected stop in waitpid");
}
OpenPOWER on IntegriCloud