Date: Mon, 14 Feb 2011 20:12:02 -0800 From: Garrett Cooper <yanegomi@gmail.com> To: freebsd-hackers@freebsd.org Subject: [PATCH] fix impossible case with waitpid(2) in truss Message-ID: <AANLkTinWcf-Y6=O3MkEwMkN6_E=jos8y2_mrw3Y1ouHa@mail.gmail.com>
next in thread | raw e-mail | index | archive | help
[-- Attachment #1 --]
Hi,
waitpid(2) returns a value in the set { -1, 0, <pid> } (-1 in the
event of an ERROR, 0 when WNOHANG is specified, <pid> when the process
exits according to wait(2)); it never returns a value < -1.
If someone could commit this patch it would be appreciated.
Thanks,
-Garrett
[-- Attachment #2 --]
Index: usr.bin/truss/setup.c
===================================================================
--- usr.bin/truss/setup.c (revision 218689)
+++ usr.bin/truss/setup.c (working copy)
@@ -83,7 +83,7 @@
}
/* Only in the parent here */
- if (waitpid(pid, &waitval, 0) < -1) {
+ if (waitpid(pid, &waitval, 0) == -1) {
err(1, "unexpect stop in waitpid");
return 0;
}
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?AANLkTinWcf-Y6=O3MkEwMkN6_E=jos8y2_mrw3Y1ouHa>
