mirror of
https://github.com/morgan9e/systemd
synced 2026-04-14 08:25:20 +09:00
tree-wide: pass -EBADF to device_monitor_new_full()
Prompted by https://github.com/systemd/systemd/pull/36922#discussion_r2024940885.
This commit is contained in:
@@ -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));
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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");
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user