Skip to content

Commit

Permalink
Make use of SAFE_MKFIFO()
Browse files Browse the repository at this point in the history
Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
  • Loading branch information
metan-ucw committed Oct 3, 2017
1 parent d84a7ec commit 23a3e80
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 15 deletions.
5 changes: 1 addition & 4 deletions testcases/kernel/ipc/pipeio/pipeio.c
Expand Up @@ -478,10 +478,7 @@ static void setup(int argc, char *argv[])
pipe_type = PIPE_UNNAMED;
blk_type = UNNAMED_IO;
} else {
if (mkfifo(pname, 0777) == -1) {
tst_brkm(TBROK | TERRNO, cleanup,
"mkfifo(%s, 0777) failed", pname);
}
SAFE_MKFIFO(cleanup, pname, 0777);
pipe_type = PIPE_NAMED;
}
}
Expand Down
3 changes: 1 addition & 2 deletions testcases/kernel/syscalls/dup/dup05.c
Expand Up @@ -167,8 +167,7 @@ void setup(void)
tst_tmpdir();

sprintf(Fname, "dupfile");
if (mkfifo(Fname, 0777) == -1)
tst_brkm(TBROK, cleanup, "mkfifo failed");
SAFE_MKFIFO(cleanup, Fname, 0777);
if ((fd = open(Fname, O_RDWR, 0700)) == -1)
tst_brkm(TBROK, cleanup, "open failed");
}
Expand Down
6 changes: 2 additions & 4 deletions testcases/kernel/syscalls/select/select03.c
Expand Up @@ -48,6 +48,7 @@
#include <sys/stat.h>

#include "test.h"
#include "safe_macros.h"

#define FILENAME "select03"

Expand Down Expand Up @@ -113,10 +114,7 @@ static void setup(void)

tst_tmpdir();

if (mkfifo(FILENAME, 0777) == -1) {
tst_brkm(TBROK, cleanup, "mkfifo(%s, 0777) failed, errno=%d",
FILENAME, errno);
}
SAFE_MKFIFO(cleanup, FILENAME, 0777);

if ((Fd = open(FILENAME, O_RDWR)) == -1) {
tst_brkm(TBROK, cleanup, "open(%s, O_RDWR) failed, errno=%d",
Expand Down
7 changes: 2 additions & 5 deletions testcases/kernel/syscalls/unlink/unlink06.c
Expand Up @@ -117,6 +117,7 @@
#include <signal.h>
#include <unistd.h>
#include "test.h"
#include "safe_macros.h"

void setup();
void create_file();
Expand Down Expand Up @@ -210,9 +211,5 @@ void cleanup(void)
******************************************************************/
void create_file(void)
{
if (mkfifo(Fname, 0777) == -1) {
tst_brkm(TBROK, cleanup,
"mkfifo(%s, 0777) failed errno:%d %s\n", Fname,
errno, strerror(errno));
}
SAFE_MKFIFO(cleanup, Fname, 0777);
}

0 comments on commit 23a3e80

Please sign in to comment.