]> git.ipfire.org Git - thirdparty/systemd.git/blobdiff - src/test/test-async.c
fileio: simplify mkostemp_safe() (#4090)
[thirdparty/systemd.git] / src / test / test-async.c
index c1c535b45dfbf677e3ac1b7dd5723914146edd26..4ebc27f0bd04a8dd5055ee2e3add6d6ba5838c13 100644 (file)
@@ -20,8 +20,9 @@
 #include <unistd.h>
 
 #include "async.h"
-#include "util.h"
+#include "fileio.h"
 #include "macro.h"
+#include "util.h"
 
 static bool test_async = false;
 
@@ -35,10 +36,12 @@ int main(int argc, char *argv[]) {
         int fd;
         char name[] = "/tmp/test-asynchronous_close.XXXXXX";
 
-        fd = mkostemp_safe(name, O_RDWR|O_CLOEXEC);
+        fd = mkostemp_safe(name);
         assert_se(fd >= 0);
         asynchronous_close(fd);
+
         assert_se(asynchronous_job(async_func, NULL) >= 0);
+
         assert_se(asynchronous_sync() >= 0);
 
         sleep(1);
@@ -46,5 +49,7 @@ int main(int argc, char *argv[]) {
         assert_se(fcntl(fd, F_GETFD) == -1);
         assert_se(test_async);
 
+        unlink(name);
+
         return 0;
 }