diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2018-12-18 14:50:42 +0900 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2019-01-12 09:32:20 +0900 |
commit | d40534643b0cc6475813b762ebd573716c4932e3 (patch) | |
tree | 0f76aaa57ae9eee687e6ec043061e472e8c92d09 /src/udev | |
parent | 1f3f6bd0078b9d76d5ed72b74b890ca5e3a1756c (diff) | |
download | systemd-d40534643b0cc6475813b762ebd573716c4932e3.tar.gz systemd-d40534643b0cc6475813b762ebd573716c4932e3.tar.bz2 systemd-d40534643b0cc6475813b762ebd573716c4932e3.zip |
udevd: use structured initializer at one more place
Diffstat (limited to 'src/udev')
-rw-r--r-- | src/udev/udevd.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/udev/udevd.c b/src/udev/udevd.c index 33fc0b3c2c..24f4824018 100644 --- a/src/udev/udevd.c +++ b/src/udev/udevd.c @@ -209,15 +209,18 @@ static int worker_new(struct worker **ret, Manager *manager, sd_device_monitor * assert(worker_monitor); assert(pid > 1); - worker = new0(struct worker, 1); + /* close monitor, but keep address around */ + device_monitor_disconnect(worker_monitor); + + worker = new(struct worker, 1); if (!worker) return -ENOMEM; - worker->manager = manager; - /* close monitor, but keep address around */ - device_monitor_disconnect(worker_monitor); - worker->monitor = sd_device_monitor_ref(worker_monitor); - worker->pid = pid; + *worker = (struct worker) { + .manager = manager, + .monitor = sd_device_monitor_ref(worker_monitor), + .pid = pid, + }; r = hashmap_ensure_allocated(&manager->workers, NULL); if (r < 0) |