1
0
mirror of https://github.com/systemd/systemd.git synced 2024-12-22 17:35:35 +03:00

udev: use sd_event_source_disable_unref()

This should not change any behavior, as the event sources are not
shared. Just for safety.
This commit is contained in:
Yu Watanabe 2022-03-15 17:47:00 +09:00 committed by Lennart Poettering
parent 87afc766d1
commit 9612da361a
3 changed files with 11 additions and 11 deletions

View 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);

View 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);

View 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);