Module Name: src
Committed By: jruoho
Date: Mon Jul 4 09:29:37 UTC 2011
Modified Files:
src/tests/syscall: t_mknod.c
Log Message:
Adjust the EEXIST-check once more. (This failed incorrectly in the Qemu-runs.)
To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/tests/syscall/t_mknod.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/tests/syscall/t_mknod.c
diff -u src/tests/syscall/t_mknod.c:1.6 src/tests/syscall/t_mknod.c:1.7
--- src/tests/syscall/t_mknod.c:1.6 Mon Jul 4 04:10:34 2011
+++ src/tests/syscall/t_mknod.c Mon Jul 4 09:29:37 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: t_mknod.c,v 1.6 2011/07/04 04:10:34 jruoho Exp $ */
+/* $NetBSD: t_mknod.c,v 1.7 2011/07/04 09:29:37 jruoho Exp $ */
/*-
* Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_mknod.c,v 1.6 2011/07/04 04:10:34 jruoho Exp $");
+__RCSID("$NetBSD: t_mknod.c,v 1.7 2011/07/04 09:29:37 jruoho Exp $");
#include <sys/stat.h>
@@ -85,7 +85,7 @@
(void)unlink(path);
}
-ATF_TC(mknod_exist);
+ATF_TC_WITH_CLEANUP(mknod_exist);
ATF_TC_HEAD(mknod_exist, tc)
{
atf_tc_set_md_var(tc, "descr", "Test EEXIST from mknod(2)");
@@ -96,16 +96,28 @@
{
int fd;
- fd = open(_PATH_DEVNULL, O_RDONLY);
+ fd = open("/etc/passwd", O_RDONLY);
+
+ if (fd >= 0) {
- if (fd < 0)
- return;
- else {
(void)close(fd);
+
+ errno = 0;
+ ATF_REQUIRE_ERRNO(EEXIST,
+ mknod("/etc/passwd", S_IFCHR, 0) == -1);
}
+ ATF_REQUIRE(mknod(path, S_IFCHR, 0) == 0);
+
errno = 0;
- ATF_REQUIRE_ERRNO(EEXIST, mknod(_PATH_DEVNULL, S_IFCHR, 0) == -1);
+ ATF_REQUIRE_ERRNO(EEXIST, mknod(path, S_IFCHR, 0) == -1);
+
+ ATF_REQUIRE(unlink(path) == 0);
+}
+
+ATF_TC_CLEANUP(mknod_exist, tc)
+{
+ (void)unlink(path);
}
ATF_TC_WITH_CLEANUP(mknod_perm);