]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
tree-wide: pass -EBADF to device_monitor_new_full()
authorYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 2 Apr 2025 14:34:29 +0000 (23:34 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 2 Apr 2025 17:14:52 +0000 (02:14 +0900)
Prompted by https://github.com/systemd/systemd/pull/36922#discussion_r2024940885.

src/libsystemd/sd-device/test-sd-device-monitor.c
src/libudev/libudev-monitor.c
src/udev/udevadm-monitor.c
src/udev/udevadm-wait.c

index 1cdeabbf21e5016999cb4590a73d8815c93b1a8a..362ce0a85ee903f8ff7ae63c9570542638f87d98 100644 (file)
@@ -56,11 +56,11 @@ static int monitor_handler(sd_device_monitor *m, sd_device *d, void *userdata) {
 static void prepare_monitor(sd_device_monitor **ret_server, sd_device_monitor **ret_client, union sockaddr_union *ret_address) {
         _cleanup_(sd_device_monitor_unrefp) sd_device_monitor *monitor_server = NULL, *monitor_client = NULL;
 
-        ASSERT_OK(device_monitor_new_full(&monitor_server, MONITOR_GROUP_NONE, -1));
+        ASSERT_OK(device_monitor_new_full(&monitor_server, MONITOR_GROUP_NONE, -EBADF));
         ASSERT_OK(sd_device_monitor_set_description(monitor_server, "sender"));
         ASSERT_OK(sd_device_monitor_start(monitor_server, NULL, NULL));
 
-        ASSERT_OK(device_monitor_new_full(&monitor_client, MONITOR_GROUP_NONE, -1));
+        ASSERT_OK(device_monitor_new_full(&monitor_client, MONITOR_GROUP_NONE, -EBADF));
         ASSERT_OK(sd_device_monitor_set_description(monitor_client, "client"));
         ASSERT_OK(device_monitor_allow_unicast_sender(monitor_client, monitor_server));
         ASSERT_OK(device_monitor_get_address(monitor_client, ret_address));
@@ -106,7 +106,7 @@ TEST(sd_device_monitor_is_running) {
 
         ASSERT_OK_ZERO(sd_device_monitor_is_running(NULL));
 
-        ASSERT_OK(device_monitor_new_full(&m, MONITOR_GROUP_NONE, -1));
+        ASSERT_OK(device_monitor_new_full(&m, MONITOR_GROUP_NONE, -EBADF));
         ASSERT_OK_ZERO(sd_device_monitor_is_running(m));
         ASSERT_OK(sd_device_monitor_start(m, NULL, NULL));
         ASSERT_OK_POSITIVE(sd_device_monitor_is_running(m));
index 55b6eb00f6769913fb0de768716f0d54f3863688..0e5f8d51738ffde3c917c39360eff9107dbdb36d 100644 (file)
@@ -73,7 +73,7 @@ _public_ struct udev_monitor *udev_monitor_new_from_netlink(struct udev *udev, c
         if (g < 0)
                 return_with_errno(NULL, EINVAL);
 
-        r = device_monitor_new_full(&m, g, -1);
+        r = device_monitor_new_full(&m, g, -EBADF);
         if (r < 0)
                 return_with_errno(NULL, r);
 
index 76b953c9179a32cd8bc0af820131961815404396..b411d45b6dbc9a8d354156f8167ee50ff2f036a7 100644 (file)
@@ -66,7 +66,7 @@ static int setup_monitor(MonitorNetlinkGroup sender, sd_event *event, sd_device_
         const char *subsystem, *devtype, *tag;
         int r;
 
-        r = device_monitor_new_full(&monitor, sender, -1);
+        r = device_monitor_new_full(&monitor, sender, -EBADF);
         if (r < 0)
                 return log_error_errno(r, "Failed to create netlink socket: %m");
 
index 39e31ad2bfe145b9468ca0d4f85e7c085f21e039..c93039895b6c630f8b8902ded93356be3203ea1a 100644 (file)
@@ -180,7 +180,7 @@ static int setup_monitor(sd_event *event, MonitorNetlinkGroup group, const char
         assert(event);
         assert(ret);
 
-        r = device_monitor_new_full(&monitor, group, /* fd = */ -1);
+        r = device_monitor_new_full(&monitor, group, -EBADF);
         if (r < 0)
                 return r;