From 6830953bc1ec74bd244c43a1952e7b5c1c321a4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dag-Erling=20Sm=C3=B8rgrav?= Date: Thu, 12 Nov 2009 01:34:55 +0000 Subject: [PATCH] Fix warnings and remove one unnecessary use of vfork(). The other could also be removed with a little more work. --- tools/regression/lib/libutil/test-flopen.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/tools/regression/lib/libutil/test-flopen.c b/tools/regression/lib/libutil/test-flopen.c index a3ae35c7ea5..04715846650 100644 --- a/tools/regression/lib/libutil/test-flopen.c +++ b/tools/regression/lib/libutil/test-flopen.c @@ -28,11 +28,11 @@ #include __FBSDID("$FreeBSD$"); -#include #include #include #include +#include #include #include #include @@ -169,16 +169,10 @@ test_flopen_lock_child(void) _exit(0); } close(fd1); - fd2 = -42; - if (vfork() == 0) { - fd2 = flopen(fn, O_RDWR|O_NONBLOCK); - close(fd2); - _exit(0); - } - if (fd2 == -42) - result = "vfork() doesn't work as expected"; - if (fd2 >= 0) + if ((fd2 = flopen(fn, O_RDWR|O_NONBLOCK)) != -1) { result = "second open succeeded"; + close(fd2); + } kill(pid, SIGINT); } unlink(fn);