diff options
author | Lennart Poettering <lennart@poettering.net> | 2016-01-12 16:03:48 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2016-01-12 16:03:48 +0100 |
commit | 45630488f9dc510c0b9da1932c5046160e6871ec (patch) | |
tree | 43606871b8012973ac6f3936d4887a5c658ce097 /src/udev/udev-watch.c | |
parent | 1f52a79d4eb0216bf1f2d96539609f02d8bb9e71 (diff) | |
parent | d054f0a4d451120c26494263fc4dc175bfd405b1 (diff) |
Merge pull request #2308 from zonque/xsprintf
tree-wide: use xsprintf() where applicable
Diffstat (limited to 'src/udev/udev-watch.c')
-rw-r--r-- | src/udev/udev-watch.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/udev/udev-watch.c b/src/udev/udev-watch.c index 60de703706..c0f4973f93 100644 --- a/src/udev/udev-watch.c +++ b/src/udev/udev-watch.c @@ -26,6 +26,7 @@ #include <sys/inotify.h> #include <unistd.h> +#include "stdio-util.h" #include "udev.h" static int inotify_fd = -1; @@ -105,7 +106,7 @@ void udev_watch_begin(struct udev *udev, struct udev_device *dev) { return; } - snprintf(filename, sizeof(filename), "/run/udev/watch/%d", wd); + xsprintf(filename, "/run/udev/watch/%d", wd); mkdir_parents(filename, 0755); unlink(filename); r = symlink(udev_device_get_id_filename(dev), filename); @@ -129,7 +130,7 @@ void udev_watch_end(struct udev *udev, struct udev_device *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); + xsprintf(filename, "/run/udev/watch/%d", wd); unlink(filename); udev_device_set_watch_handle(dev, -1); @@ -143,7 +144,7 @@ struct udev_device *udev_watch_lookup(struct udev *udev, int wd) { if (inotify_fd < 0 || wd < 0) return NULL; - snprintf(filename, sizeof(filename), "/run/udev/watch/%d", wd); + xsprintf(filename, "/run/udev/watch/%d", wd); len = readlink(filename, device, sizeof(device)); if (len <= 0 || (size_t)len == sizeof(device)) return NULL; |