diff options
author | Lennart Poettering <lennart@poettering.net> | 2018-10-16 13:48:25 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2018-10-16 13:52:21 +0200 |
commit | eb276e98419af59d4a587f2dd37e0b923e4c6fd2 (patch) | |
tree | 6c24b6a7b9751d7dc9fb849c8a4f9c40a4f3cafa /src/udev/udev-watch.c | |
parent | core: log about unit_watch_pid() failing (diff) | |
download | systemd-eb276e98419af59d4a587f2dd37e0b923e4c6fd2.tar.xz systemd-eb276e98419af59d4a587f2dd37e0b923e4c6fd2.zip |
udev: don't use devname before we acquired it
CID 1396107
Diffstat (limited to 'src/udev/udev-watch.c')
-rw-r--r-- | src/udev/udev-watch.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/udev/udev-watch.c b/src/udev/udev-watch.c index cfcb310d23..04182b2e15 100644 --- a/src/udev/udev-watch.c +++ b/src/udev/udev-watch.c @@ -127,16 +127,16 @@ int udev_watch_end(sd_device *dev) { if (inotify_fd < 0) return log_error_errno(EINVAL, "Invalid inotify descriptor."); + r = sd_device_get_devname(dev, &devnode); + if (r < 0) + return log_error_errno(r, "Failed to get device name: %m"); + r = device_get_watch_handle(dev, &wd); if (r == -ENOENT) return 0; if (r < 0) return log_error_errno(r, "Failed to get watch handle for device '%s', ignoring: %m", devnode); - r = sd_device_get_devname(dev, &devnode); - if (r < 0) - return log_error_errno(r, "Failed to get device name: %m"); - log_debug("Removing watch on '%s'", devnode); (void) inotify_rm_watch(inotify_fd, wd); |