Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/tests/lib/libc PR/51868: Ngie Cooper: mkfifo does not return...
details: https://anonhg.NetBSD.org/src/rev/0be3d8fc3417
branches: trunk
changeset: 350626:0be3d8fc3417
user: christos <christos%NetBSD.org@localhost>
date: Sat Jan 14 20:55:26 2017 +0000
description:
PR/51868: Ngie Cooper: mkfifo does not return an fd
diffstat:
tests/lib/libc/c063/t_mkfifoat.c | 17 ++++++-----------
tests/lib/libc/sys/t_unlink.c | 9 +++------
2 files changed, 9 insertions(+), 17 deletions(-)
diffs (99 lines):
diff -r b3f9869748bf -r 0be3d8fc3417 tests/lib/libc/c063/t_mkfifoat.c
--- a/tests/lib/libc/c063/t_mkfifoat.c Sat Jan 14 20:52:42 2017 +0000
+++ b/tests/lib/libc/c063/t_mkfifoat.c Sat Jan 14 20:55:26 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: t_mkfifoat.c,v 1.3 2017/01/10 15:15:09 christos Exp $ */
+/* $NetBSD: t_mkfifoat.c,v 1.4 2017/01/14 20:55:26 christos Exp $ */
/*-
* Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_mkfifoat.c,v 1.3 2017/01/10 15:15:09 christos Exp $");
+__RCSID("$NetBSD: t_mkfifoat.c,v 1.4 2017/01/14 20:55:26 christos Exp $");
#include <atf-c.h>
#include <errno.h>
@@ -55,13 +55,11 @@
ATF_TC_BODY(mkfifoat_fd, tc)
{
int dfd;
- int fd;
mode_t mode = 0600;
ATF_REQUIRE(mkdir(DIR, 0755) == 0);
ATF_REQUIRE((dfd = open(DIR, O_RDONLY, 0)) != -1);
- ATF_REQUIRE((fd = mkfifoat(dfd, BASEFIFO, mode)) != -1);
- ATF_REQUIRE(close(fd) == 0);
+ ATF_REQUIRE(mkfifoat(dfd, BASEFIFO, mode) != -1);
ATF_REQUIRE(access(FIFO, F_OK) == 0);
(void)close(dfd);
}
@@ -74,12 +72,10 @@
}
ATF_TC_BODY(mkfifoat_fdcwd, tc)
{
- int fd;
mode_t mode = 0600;
ATF_REQUIRE(mkdir(DIR, 0755) == 0);
- ATF_REQUIRE((fd = mkfifoat(AT_FDCWD, FIFO, mode)) != -1);
- ATF_REQUIRE(close(fd) == 0);
+ ATF_REQUIRE(mkfifoat(AT_FDCWD, FIFO, mode) != -1);
ATF_REQUIRE(access(FIFO, F_OK) == 0);
}
@@ -91,10 +87,9 @@
}
ATF_TC_BODY(mkfifoat_fdcwderr, tc)
{
- int fd;
mode_t mode = 0600;
- ATF_REQUIRE((fd = mkfifoat(AT_FDCWD, FIFOERR, mode)) == -1);
+ ATF_REQUIRE(mkfifoat(AT_FDCWD, FIFOERR, mode) == -1);
}
ATF_TC(mkfifoat_fderr);
@@ -110,7 +105,7 @@
ATF_REQUIRE(mkdir(DIR, 0755) == 0);
ATF_REQUIRE((fd = open(FIFO, O_CREAT|O_RDWR, 0644)) != -1);
ATF_REQUIRE(close(fd) == 0);
- ATF_REQUIRE((fd = mkfifoat(-1, FIFO, mode)) == -1);
+ ATF_REQUIRE(mkfifoat(-1, FIFO, mode) == -1);
}
ATF_TP_ADD_TCS(tp)
diff -r b3f9869748bf -r 0be3d8fc3417 tests/lib/libc/sys/t_unlink.c
--- a/tests/lib/libc/sys/t_unlink.c Sat Jan 14 20:52:42 2017 +0000
+++ b/tests/lib/libc/sys/t_unlink.c Sat Jan 14 20:55:26 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: t_unlink.c,v 1.3 2017/01/13 19:33:03 christos Exp $ */
+/* $NetBSD: t_unlink.c,v 1.4 2017/01/14 20:55:26 christos Exp $ */
/*-
* Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_unlink.c,v 1.3 2017/01/13 19:33:03 christos Exp $");
+__RCSID("$NetBSD: t_unlink.c,v 1.4 2017/01/14 20:55:26 christos Exp $");
#include <sys/stat.h>
@@ -107,11 +107,8 @@
ATF_TC_BODY(unlink_fifo, tc)
{
- int fd;
- ATF_REQUIRE_MSG((fd = mkfifo(path, 0666)) == 0,
- "mkfifo failed: %s", strerror(errno));
- (void)close(fd);
+ ATF_REQUIRE(mkfifo(path, 0666) == 0);
ATF_REQUIRE(unlink(path) == 0);
errno = 0;
Home |
Main Index |
Thread Index |
Old Index