summaryrefslogtreecommitdiff
path: root/udev/udev_utils.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_utils.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_utils.c')
-rw-r--r--udev/udev_utils.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/udev/udev_utils.c b/udev/udev_utils.c
index 09b965ef3b..4623c30caf 100644
--- a/udev/udev_utils.c
+++ b/udev/udev_utils.c
@@ -132,7 +132,7 @@ int add_matching_files(struct udev *udev, struct list_head *name_list, const cha
dbg(udev, "open directory '%s'\n", dirname);
dir = opendir(dirname);
if (dir == NULL) {
- err(udev, "unable to open '%s': %s\n", dirname, strerror(errno));
+ err(udev, "unable to open '%s': %m\n", dirname);
return -1;
}
@@ -176,7 +176,7 @@ uid_t lookup_user(struct udev *udev, const char *user)
if (errno == 0 || errno == ENOENT || errno == ESRCH)
err(udev, "specified user '%s' unknown\n", user);
else
- err(udev, "error resolving user '%s': %s\n", user, strerror(errno));
+ err(udev, "error resolving user '%s': %m\n", user);
} else
uid = pw->pw_uid;
@@ -194,7 +194,7 @@ extern gid_t lookup_group(struct udev *udev, const char *group)
if (errno == 0 || errno == ENOENT || errno == ESRCH)
err(udev, "specified group '%s' unknown\n", group);
else
- err(udev, "error resolving group '%s': %s\n", group, strerror(errno));
+ err(udev, "error resolving group '%s': %m\n", group);
} else
gid = gr->gr_gid;