diff options
author | ngie <ngie@FreeBSD.org> | 2017-01-14 00:33:07 +0000 |
---|---|---|
committer | ngie <ngie@FreeBSD.org> | 2017-01-14 00:33:07 +0000 |
commit | 202c7be0d1f7b6d6b14504724fb06f1a4d7f6a1a (patch) | |
tree | 73b8a2f14e75025d3bd6a66d2e5a57c10fe2d004 /contrib/netbsd-tests/lib/libc | |
parent | 14c1b6aaf347ae195e2e35d91b6d4baa077e7efc (diff) | |
download | FreeBSD-src-202c7be0d1f7b6d6b14504724fb06f1a4d7f6a1a.zip FreeBSD-src-202c7be0d1f7b6d6b14504724fb06f1a4d7f6a1a.tar.gz |
MFC r311236,r311919:
r311236:
unlink_fifo: don't leak the file descriptors opened with mkfifo and open
MFC fater: 3 days
CID: 978316, 978317
r311919:
Partially revert r311236
There's no sense in trying to close a file descriptor from the negative cases
with unlink_test; it's best to ignore these cases.
The mkfifo case does make sense to keep though.
Diffstat (limited to 'contrib/netbsd-tests/lib/libc')
-rw-r--r-- | contrib/netbsd-tests/lib/libc/sys/t_unlink.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/contrib/netbsd-tests/lib/libc/sys/t_unlink.c b/contrib/netbsd-tests/lib/libc/sys/t_unlink.c index 8d94668..b504bb0 100644 --- a/contrib/netbsd-tests/lib/libc/sys/t_unlink.c +++ b/contrib/netbsd-tests/lib/libc/sys/t_unlink.c @@ -111,8 +111,15 @@ ATF_TC_HEAD(unlink_fifo, tc) ATF_TC_BODY(unlink_fifo, tc) { +#ifdef __FreeBSD__ + int fd; + ATF_REQUIRE_MSG((fd = mkfifo(path, 0666)) == 0, + "mkfifo failed: %s", strerror(errno)); + (void)close(fd); +#else ATF_REQUIRE(mkfifo(path, 0666) == 0); +#endif ATF_REQUIRE(unlink(path) == 0); errno = 0; |