chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
tmpfiles: always recreate the most basic directory structure in /var
[elogind.git]
/
src
/
udev
/
udev-watch.c
diff --git
a/src/udev/udev-watch.c
b/src/udev/udev-watch.c
index c27a280bd30ce510a5b626f82a9a810fec9d09ff..cbe0c37a4fe8c79309848618e7cf816232bbbb3b 100644
(file)
--- a/
src/udev/udev-watch.c
+++ b/
src/udev/udev-watch.c
@@
-1,5
+1,5
@@
/*
/*
- * Copyright (C) 2004-2012 Kay Sievers <kay
.sievers
@vrfy.org>
+ * Copyright (C) 2004-2012 Kay Sievers <kay@vrfy.org>
* Copyright (C) 2009 Canonical Ltd.
* Copyright (C) 2009 Scott James Remnant <scott@netsplit.com>
*
* Copyright (C) 2009 Canonical Ltd.
* Copyright (C) 2009 Scott James Remnant <scott@netsplit.com>
*
@@
-40,7
+40,7
@@
int udev_watch_init(struct udev *udev)
{
inotify_fd = inotify_init1(IN_CLOEXEC);
if (inotify_fd < 0)
{
inotify_fd = inotify_init1(IN_CLOEXEC);
if (inotify_fd < 0)
- log_error("inotify_init failed: %m
\n
");
+ log_error("inotify_init failed: %m");
return inotify_fd;
}
return inotify_fd;
}
@@
-79,7
+79,7
@@
void udev_watch_restore(struct udev *udev)
if (dev == NULL)
goto unlink;
if (dev == NULL)
goto unlink;
- log_debug("restoring old watch on '%s'
\n
", udev_device_get_devnode(dev));
+ log_debug("restoring old watch on '%s'", udev_device_get_devnode(dev));
udev_watch_begin(udev, dev);
udev_device_unref(dev);
unlink:
udev_watch_begin(udev, dev);
udev_device_unref(dev);
unlink:
@@
-98,14
+98,15
@@
void udev_watch_begin(struct udev *udev, struct udev_device *dev)
{
char filename[UTIL_PATH_SIZE];
int wd;
{
char filename[UTIL_PATH_SIZE];
int wd;
+ int r;
if (inotify_fd < 0)
return;
if (inotify_fd < 0)
return;
- log_debug("adding watch on '%s'
\n
", udev_device_get_devnode(dev));
+ log_debug("adding watch on '%s'", udev_device_get_devnode(dev));
wd = inotify_add_watch(inotify_fd, udev_device_get_devnode(dev), IN_CLOSE_WRITE);
if (wd < 0) {
wd = inotify_add_watch(inotify_fd, udev_device_get_devnode(dev), IN_CLOSE_WRITE);
if (wd < 0) {
- log_error("inotify_add_watch(%d, %s, %o) failed: %m
\n
",
+ log_error("inotify_add_watch(%d, %s, %o) failed: %m",
inotify_fd, udev_device_get_devnode(dev), IN_CLOSE_WRITE);
return;
}
inotify_fd, udev_device_get_devnode(dev), IN_CLOSE_WRITE);
return;
}
@@
-113,7
+114,9
@@
void udev_watch_begin(struct udev *udev, struct udev_device *dev)
snprintf(filename, sizeof(filename), "/run/udev/watch/%d", wd);
mkdir_parents(filename, 0755);
unlink(filename);
snprintf(filename, sizeof(filename), "/run/udev/watch/%d", wd);
mkdir_parents(filename, 0755);
unlink(filename);
- symlink(udev_device_get_id_filename(dev), filename);
+ r = symlink(udev_device_get_id_filename(dev), filename);
+ if (r < 0)
+ log_error("Failed to create symlink %s: %m", filename);
udev_device_set_watch_handle(dev, wd);
}
udev_device_set_watch_handle(dev, wd);
}
@@
-130,7
+133,7
@@
void udev_watch_end(struct udev *udev, struct udev_device *dev)
if (wd < 0)
return;
if (wd < 0)
return;
- log_debug("removing watch on '%s'
\n
", udev_device_get_devnode(dev));
+ log_debug("removing watch on '%s'", udev_device_get_devnode(dev));
inotify_rm_watch(inotify_fd, wd);
snprintf(filename, sizeof(filename), "/run/udev/watch/%d", wd);
inotify_rm_watch(inotify_fd, wd);
snprintf(filename, sizeof(filename), "/run/udev/watch/%d", wd);