diff --git a/src/tests/system/libroot/posix/Jamfile b/src/tests/system/libroot/posix/Jamfile index 8974881f00..68b4cb1e2c 100644 --- a/src/tests/system/libroot/posix/Jamfile +++ b/src/tests/system/libroot/posix/Jamfile @@ -14,6 +14,7 @@ SimpleTest calloc_test : calloc_test.c ; SimpleTest chmod : chmod.cpp ; SimpleTest clearenv : clearenv.cpp ; SimpleTest dirent_test : dirent_test.cpp ; +SimpleTest fifo_test : fifo_test.cpp ; SimpleTest flock_test : flock_test.cpp ; SimpleTest fseek_test : fseek_test.cpp ; SimpleTest getsubopt_test : getsubopt_test.cpp ; diff --git a/src/tests/system/libroot/posix/fifo_test.cpp b/src/tests/system/libroot/posix/fifo_test.cpp new file mode 100644 index 0000000000..b65c661e83 --- /dev/null +++ b/src/tests/system/libroot/posix/fifo_test.cpp @@ -0,0 +1,38 @@ +#include +#include +#include +#include +#include +#include + +int +main(int argc, char** argv) +{ + const char* filename = "temp.fifo"; + + if (mkfifo("temp.fifo", S_IRWXU) != 0) { + perror("mkfifo error"); + return 1; + } + + int rfd = open(filename, O_RDONLY | O_NONBLOCK); + if (rfd < 0) { + perror("open() error"); + return 1; + } + + DIR* dir = opendir(filename); + if (dir != NULL) { + perror("opendir succeeded"); + return 1; + } + + dir = fdopendir(rfd); + if (dir != NULL) { + perror("fdopendir succeeded"); + return 1; + } + + unlink(filename); + return 0; +}