summaryrefslogtreecommitdiff
path: root/regress/sys
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2002-02-17 18:32:10 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2002-02-17 18:32:10 +0000
commit7e554e176e12c53d6da3c5b9cfb7e6c4e6af4d7b (patch)
tree810a086a8359205c57d76d4de846b8a34fb7ad4b /regress/sys
parent27d0dde5962a658b35998c2b70c596bcbcdfd987 (diff)
kill little bugs; art ok
Diffstat (limited to 'regress/sys')
-rw-r--r--regress/sys/kern/rfork/rfsharefd/rfsharefd.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/regress/sys/kern/rfork/rfsharefd/rfsharefd.c b/regress/sys/kern/rfork/rfsharefd/rfsharefd.c
index fdd6655ee7d..81ce1725c35 100644
--- a/regress/sys/kern/rfork/rfsharefd/rfsharefd.c
+++ b/regress/sys/kern/rfork/rfsharefd/rfsharefd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rfsharefd.c,v 1.1 2002/02/17 05:44:07 art Exp $ */
+/* $OpenBSD: rfsharefd.c,v 1.2 2002/02/17 18:32:09 deraadt Exp $ */
/*
* Written by Artur Grabowski <art@openbsd.org>, 2002 Public Domain.
*/
@@ -14,16 +14,17 @@ int
main()
{
int status;
+ int fd;
/* Make sure that at least fd 0 is allocated. */
- if (open("/dev/null", O_RDONLY) < 0)
+ if ((fd = open("/dev/null", O_RDONLY)) < 0)
err(1, "open(/dev/null)");
switch(rfork(RFPROC)) {
case -1:
err(1, "fork");
case 0:
- if (close(0) < 0)
+ if (close(fd) < 0)
_exit(1);
_exit(0);
}
@@ -34,8 +35,8 @@ main()
if (!WIFEXITED(status))
err(1, "child error");
- if (close(0) == 0)
+ if (close(fd) == 0)
errx(1, "fd 0 not closed");
return WEXITSTATUS(status) != 0;
-} \ No newline at end of file
+}