summaryrefslogtreecommitdiffstats
path: root/src/udev/udev-watch.c
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2018-10-16 21:04:35 +0200
committerLennart Poettering <lennart@poettering.net>2018-10-17 18:02:23 +0200
commitd86c8a6cdb7ae42819d7f0e8a8695e3982ef4ca9 (patch)
treec520d1990e9655933a7a11e19772c06a0c3de67b /src/udev/udev-watch.c
parentMerge pull request #10244 from poettering/nofile-bump (diff)
downloadsystemd-d86c8a6cdb7ae42819d7f0e8a8695e3982ef4ca9.tar.xz
systemd-d86c8a6cdb7ae42819d7f0e8a8695e3982ef4ca9.zip
udev: make sd_device_get_devname() failure non-fatal
As it is just for logging. Follow-up for eb276e98419af59d4a587f2dd37e0b923e4c6fd2.
Diffstat (limited to 'src/udev/udev-watch.c')
-rw-r--r--src/udev/udev-watch.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/udev/udev-watch.c b/src/udev/udev-watch.c
index 04182b2e15..3f5885c52e 100644
--- a/src/udev/udev-watch.c
+++ b/src/udev/udev-watch.c
@@ -121,23 +121,22 @@ int udev_watch_begin(sd_device *dev) {
int udev_watch_end(sd_device *dev) {
char filename[STRLEN("/run/udev/watch/") + DECIMAL_STR_MAX(int)];
- const char *devnode;
+ const char *name = NULL;
int wd, r;
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");
+ if (sd_device_get_devname(dev, &name) < 0)
+ (void) sd_device_get_syspath(dev, &name);
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);
+ return log_error_errno(r, "Failed to get watch handle for device '%s', ignoring: %m", strnull(name));
- log_debug("Removing watch on '%s'", devnode);
+ log_debug("Removing watch on '%s'", strnull(name));
(void) inotify_rm_watch(inotify_fd, wd);
xsprintf(filename, "/run/udev/watch/%d", wd);