]> git.ipfire.org Git - thirdparty/systemd.git/commit - src/libsystemd/sd-network/sd-network.c
sd-network: Keep inotify watch if watch descriptor didn't change
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Tue, 3 May 2022 11:54:49 +0000 (13:54 +0200)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 3 May 2022 22:00:56 +0000 (07:00 +0900)
commit206c0897a28e185f648dd3c7cdefdbe7680b0528
tree5d55299961836bbba46a500085bf503c781e078c
parentd31b8a66d187523dab5d19a9269c9543382e021d
sd-network: Keep inotify watch if watch descriptor didn't change

In sd_network_monitor_flush(), we shouldn't remove the inotify
watch for the current directory if the directory the network
monitor is waiting for wasn't created yet.

inotify_add_watch() returns the same unique watch descriptor if a
path is already being watched. Let's return the watch descriptor
from monitor_add_inotify_watch() so we can check if it's the same
as the watch descriptor of the inotify event. If they are equal,
we're still watching the same path and we don't need to remove the
inotify watch just yet.
src/libsystemd/sd-network/sd-network.c