summaryrefslogtreecommitdiff
path: root/src/libudev/libudev-util.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2014-02-17 08:39:47 -0500
committerAnthony G. Basile <blueness@gentoo.org>2014-02-21 10:05:22 -0500
commit9fa108ac48c9b76111589967184436bf63109731 (patch)
treea17d913ab78fdb340c1b7ce13c83563937cc316c /src/libudev/libudev-util.c
parentc1db5c60e38fa4b1cd2c590dbc8ce95c4fc3844b (diff)
everywhere: make use of new0() and macro() macros, and stop using perror()
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
Diffstat (limited to 'src/libudev/libudev-util.c')
-rw-r--r--src/libudev/libudev-util.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/libudev/libudev-util.c b/src/libudev/libudev-util.c
index 2c31d5b1db..531c76c6a3 100644
--- a/src/libudev/libudev-util.c
+++ b/src/libudev/libudev-util.c
@@ -211,6 +211,7 @@ int util_resolve_subsys_kernel(struct udev *udev, const char *string,
udev_device_unref(dev);
return 0;
}
+
ssize_t util_get_sys_core_link_value(struct udev *udev, const char *slink, const char *syspath, char *value, size_t size)
{
char path[UTIL_PATH_SIZE];
@@ -425,7 +426,7 @@ uint64_t util_string_bloom64(const char *str)
ssize_t print_kmsg(const char *fmt, ...)
{
- int fd;
+ _cleanup_close_ int fd = -1;
va_list ap;
char text[1024];
ssize_t len;
@@ -443,7 +444,7 @@ ssize_t print_kmsg(const char *fmt, ...)
ret = write(fd, text, len);
if (ret < 0)
- ret = -errno;
- close(fd);
+ return -errno;
+
return ret;
}