From 659353f5a9a52336c41cf595d933311b8dc48937 Mon Sep 17 00:00:00 2001 From: Alan Jenkins Date: Mon, 29 Sep 2008 16:01:32 +0100 Subject: 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 --- udev/lib/libudev.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'udev/lib/libudev.c') 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 } -- cgit v1.2.3-54-g00ecf