diff options
author | Alan Jenkins <alan-jenkins@tuffmail.co.uk> | 2008-09-29 16:01:32 +0100 |
---|---|---|
committer | Kay Sievers <kay.sievers@vrfy.org> | 2008-09-29 17:06:00 +0200 |
commit | 659353f5a9a52336c41cf595d933311b8dc48937 (patch) | |
tree | 1a12cc4fd2ec90db52a0f586e08a2f49a6ca8306 /udev/lib/libudev.c | |
parent | 5c0f595d91a21b1fba2b9edd89511a072036d0e8 (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/lib/libudev.c')
-rw-r--r-- | udev/lib/libudev.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/udev/lib/libudev.c b/udev/lib/libudev.c index 4fd8196bd9..12220e7a78 100644 --- a/udev/lib/libudev.c +++ b/udev/lib/libudev.c @@ -131,7 +131,7 @@ void udev_selinux_lsetfilecon(struct udev *udev, const char *file, unsigned int return; } if (lsetfilecon(file, scontext) < 0) - err(udev, "setfilecon %s failed: %s\n", file, strerror(errno)); + err(udev, "setfilecon %s failed: %m\n", file); freecon(scontext); } #endif @@ -150,7 +150,7 @@ void udev_selinux_setfscreatecon(struct udev *udev, const char *file, unsigned i return; } if (setfscreatecon(scontext) < 0) - err(udev, "setfscreatecon %s failed: %s\n", file, strerror(errno)); + err(udev, "setfscreatecon %s failed: %m\n", file); freecon(scontext); } #endif @@ -163,7 +163,7 @@ void udev_selinux_resetfscreatecon(struct udev *udev) selinux_init(udev); if (udev->selinux_enabled) { if (setfscreatecon(udev->selinux_prev_scontext) < 0) - err(udev, "setfscreatecon failed: %s\n", strerror(errno)); + err(udev, "setfscreatecon failed: %m\n"); } #endif } |