summaryrefslogtreecommitdiff
path: root/udev/udev_utils_file.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_file.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_file.c')
-rw-r--r--udev/udev_utils_file.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/udev/udev_utils_file.c b/udev/udev_utils_file.c
index 1c7b07347b..84ff09e050 100644
--- a/udev/udev_utils_file.c
+++ b/udev/udev_utils_file.c
@@ -91,7 +91,7 @@ int delete_path(struct udev *udev, const char *path)
if (retval) {
if (errno == ENOTEMPTY)
return 0;
- err(udev, "rmdir(%s) failed: %s\n", p, strerror(errno));
+ err(udev, "rmdir(%s) failed: %m\n", p);
break;
}
dbg(udev, "removed '%s'\n", p);
@@ -108,18 +108,18 @@ int unlink_secure(struct udev *udev, const char *filename)
retval = chown(filename, 0, 0);
if (retval)
- err(udev, "chown(%s, 0, 0) failed: %s\n", filename, strerror(errno));
+ err(udev, "chown(%s, 0, 0) failed: %m\n", filename);
retval = chmod(filename, 0000);
if (retval)
- err(udev, "chmod(%s, 0000) failed: %s\n", filename, strerror(errno));
+ err(udev, "chmod(%s, 0000) failed: %m\n", filename);
retval = unlink(filename);
if (errno == ENOENT)
retval = 0;
if (retval)
- err(udev, "unlink(%s) failed: %s\n", filename, strerror(errno));
+ err(udev, "unlink(%s) failed: %m\n", filename);
return retval;
}