]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
udev: use sd_event_source_disable_unref()
authorYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 15 Mar 2022 08:47:00 +0000 (17:47 +0900)
committerLennart Poettering <lennart@poettering.net>
Thu, 24 Mar 2022 15:19:20 +0000 (16:19 +0100)
This should not change any behavior, as the event sources are not
shared. Just for safety.

src/udev/udev-ctrl.c
src/udev/udev-event.c
src/udev/udevd.c

index 8adef4773281f50f8e8e55d96a80502b7824e8df..45e45162ae534b2f6bf220f859d66e4047ce9753 100644 (file)
@@ -101,7 +101,7 @@ static void udev_ctrl_disconnect(UdevCtrl *uctrl) {
         if (!uctrl)
                 return;
 
-        uctrl->event_source_connect = sd_event_source_unref(uctrl->event_source_connect);
+        uctrl->event_source_connect = sd_event_source_disable_unref(uctrl->event_source_connect);
         uctrl->sock_connect = safe_close(uctrl->sock_connect);
 }
 
@@ -110,7 +110,7 @@ static UdevCtrl *udev_ctrl_free(UdevCtrl *uctrl) {
 
         udev_ctrl_disconnect(uctrl);
 
-        sd_event_source_unref(uctrl->event_source);
+        sd_event_source_disable_unref(uctrl->event_source);
         safe_close(uctrl->sock);
 
         sd_event_unref(uctrl->event);
@@ -323,7 +323,7 @@ int udev_ctrl_send(UdevCtrl *uctrl, UdevCtrlMessageType type, const void *data)
 }
 
 int udev_ctrl_wait(UdevCtrl *uctrl, usec_t timeout) {
-        _cleanup_(sd_event_source_unrefp) sd_event_source *source_io = NULL, *source_timeout = NULL;
+        _cleanup_(sd_event_source_disable_unrefp) sd_event_source *source_io = NULL, *source_timeout = NULL;
         int r;
 
         assert(uctrl);
index 76fbbc1954fd67a213f1af8030740b12bbb39ab5..d9af8bfd203fedd6534c12205b752e435ee765b0 100644 (file)
@@ -695,9 +695,9 @@ static int on_spawn_sigchld(sd_event_source *s, const siginfo_t *si, void *userd
 
 static int spawn_wait(Spawn *spawn) {
         _cleanup_(sd_event_unrefp) sd_event *e = NULL;
-        _cleanup_(sd_event_source_unrefp) sd_event_source *sigchld_source = NULL;
-        _cleanup_(sd_event_source_unrefp) sd_event_source *stdout_source = NULL;
-        _cleanup_(sd_event_source_unrefp) sd_event_source *stderr_source = NULL;
+        _cleanup_(sd_event_source_disable_unrefp) sd_event_source *sigchld_source = NULL;
+        _cleanup_(sd_event_source_disable_unrefp) sd_event_source *stdout_source = NULL;
+        _cleanup_(sd_event_source_disable_unrefp) sd_event_source *stderr_source = NULL;
         int r;
 
         assert(spawn);
index 0407068d5112ca9d3f8f13e56bd04d79ae69f57d..6bb9eeb4bb37e45168783d3e56bce3290ca108ac 100644 (file)
@@ -165,8 +165,8 @@ static Event *event_free(Event *event) {
         sd_device_unref(event->dev);
         sd_device_unref(event->dev_kernel);
 
-        sd_event_source_unref(event->timeout_warning_event);
-        sd_event_source_unref(event->timeout_event);
+        sd_event_source_disable_unref(event->timeout_warning_event);
+        sd_event_source_disable_unref(event->timeout_event);
 
         if (event->worker)
                 event->worker->event = NULL;
@@ -208,8 +208,8 @@ DEFINE_PRIVATE_HASH_OPS_WITH_VALUE_DESTRUCTOR(worker_hash_op, void, trivial_hash
 static void manager_clear_for_worker(Manager *manager) {
         assert(manager);
 
-        manager->inotify_event = sd_event_source_unref(manager->inotify_event);
-        manager->kill_workers_event = sd_event_source_unref(manager->kill_workers_event);
+        manager->inotify_event = sd_event_source_disable_unref(manager->inotify_event);
+        manager->kill_workers_event = sd_event_source_disable_unref(manager->kill_workers_event);
 
         manager->event = sd_event_unref(manager->event);
 
@@ -306,7 +306,7 @@ static void manager_exit(Manager *manager) {
         /* close sources of new events and discard buffered events */
         manager->ctrl = udev_ctrl_unref(manager->ctrl);
 
-        manager->inotify_event = sd_event_source_unref(manager->inotify_event);
+        manager->inotify_event = sd_event_source_disable_unref(manager->inotify_event);
         manager->inotify_fd = safe_close(manager->inotify_fd);
 
         manager->monitor = sd_device_monitor_unref(manager->monitor);