PR/51868: Ngie Cooper: mkfifo does not return an fd
This commit is contained in:
parent
5f5a00ced0
commit
dcc3af2fc9
|
@ -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_HEAD(mkfifoat_fd, tc)
|
|||
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_HEAD(mkfifoat_fdcwd, tc)
|
|||
}
|
||||
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_HEAD(mkfifoat_fdcwderr, tc)
|
|||
}
|
||||
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_TC_BODY(mkfifoat_fderr, tc)
|
|||
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)
|
||||
|
|
|
@ -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_HEAD(unlink_fifo, tc)
|
|||
|
||||
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;
|
||||
|
|
Loading…
Reference in New Issue