summaryrefslogtreecommitdiff
path: root/udev/udev_sysfs.c
diff options
context:
space:
mode:
authorAlan Jenkins <alan-jenkins@tuffmail.co.uk>2008-09-29 16:01:32 +0100
committerKay Sievers <kay.sievers@vrfy.org>2008-09-29 17:06:00 +0200
commit659353f5a9a52336c41cf595d933311b8dc48937 (patch)
tree1a12cc4fd2ec90db52a0f586e08a2f49a6ca8306 /udev/udev_sysfs.c
parent5c0f595d91a21b1fba2b9edd89511a072036d0e8 (diff)
replace strerror() usage with threadsafe "%m" format string
strerror() is not threadsafe. It uses a buffer to build messages of the form "Unknown error 387689". syslog() provides a %m format which is equivalent to strerror(errno). As a GNU extension, this is also accepted by printf and friends. At least in the current implementation, it is correctly threadsafe. Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
Diffstat (limited to 'udev/udev_sysfs.c')
-rw-r--r--udev/udev_sysfs.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/udev/udev_sysfs.c b/udev/udev_sysfs.c
index 3e395a2801..2ea724a78f 100644
--- a/udev/udev_sysfs.c
+++ b/udev/udev_sysfs.c
@@ -173,7 +173,7 @@ struct sysfs_device *sysfs_device_get(struct udev *udev, const char *devpath)
util_strlcpy(path, udev_get_sys_path(udev), sizeof(path));
util_strlcat(path, devpath_real, sizeof(path));
if (lstat(path, &statbuf) != 0) {
- dbg(udev, "stat '%s' failed: %s\n", path, strerror(errno));
+ dbg(udev, "stat '%s' failed: %m\n", path);
return NULL;
}
if (S_ISLNK(statbuf.st_mode)) {
@@ -352,7 +352,7 @@ char *sysfs_attr_get_value(struct udev *udev, const char *devpath, const char *a
list_add(&attr->node, &attr_list);
if (lstat(path_full, &statbuf) != 0) {
- dbg(udev, "stat '%s' failed: %s\n", path_full, strerror(errno));
+ dbg(udev, "stat '%s' failed: %m\n", path_full);
goto out;
}