]> git.ipfire.org Git - thirdparty/systemd.git/blobdiff - src/libsystemd/sd-event/test-event.c
tree-wide: use -EBADF also in pipe initializers
[thirdparty/systemd.git] / src / libsystemd / sd-event / test-event.c
index 246658d024600670fea71e62a8e8da8d4b87c2ff..7cc4cc9e28382b125c52d8dc41d15a239c708506 100644 (file)
@@ -21,7 +21,6 @@
 #include "string-util.h"
 #include "tests.h"
 #include "tmpfile-util.h"
-#include "util.h"
 
 static int prepare_handler(sd_event_source *s, void *userdata) {
         log_info("preparing %c", PTR_TO_INT(userdata));
@@ -199,7 +198,8 @@ static void test_basic_one(bool with_pidfd) {
         sd_event *e = NULL;
         sd_event_source *w = NULL, *x = NULL, *y = NULL, *z = NULL, *q = NULL, *t = NULL;
         static const char ch = 'x';
-        int a[2] = { -1, -1 }, b[2] = { -1, -1}, d[2] = { -1, -1}, k[2] = { -1, -1 };
+        int a[2] = { -EBADF, -EBADF }, b[2] = { -EBADF, -EBADF },
+            d[2] = { -EBADF, -EBADF }, k[2] = { -EBADF, -EBADF };
         uint64_t event_now;
         int64_t priority;
 
@@ -226,8 +226,7 @@ static void test_basic_one(bool with_pidfd) {
 
         got_a = false, got_b = false, got_c = false, got_d = 0;
 
-        /* Add a oneshot handler, trigger it, reenable it, and trigger
-         * it again. */
+        /* Add a oneshot handler, trigger it, reenable it, and trigger it again. */
         assert_se(sd_event_add_io(e, &w, d[0], EPOLLIN, io_handler, INT_TO_PTR('d')) >= 0);
         assert_se(sd_event_source_set_enabled(w, SD_EVENT_ONESHOT) >= 0);
         assert_se(write(d[1], &ch, 1) >= 0);
@@ -743,7 +742,7 @@ TEST(inotify_self_destroy) {
         _cleanup_(sd_event_source_unrefp) sd_event_source *s = NULL;
         _cleanup_(sd_event_unrefp) sd_event *e = NULL;
         char path[] = "/tmp/inotifyXXXXXX";
-        _cleanup_close_ int fd = -1;
+        _cleanup_close_ int fd = -EBADF;
 
         /* Tests that destroying an inotify event source from its own handler is safe */