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/udev_node.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/udev_node.c')
-rw-r--r-- | udev/udev_node.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/udev/udev_node.c b/udev/udev_node.c index 8971f9ff3f..a43e5bd63f 100644 --- a/udev/udev_node.c +++ b/udev/udev_node.c @@ -58,13 +58,13 @@ int udev_node_mknod(struct udevice *udevice, const char *file, dev_t devt, mode_ err = mknod(file_tmp, mode, devt); udev_selinux_resetfscreatecon(udevice->udev); if (err != 0) { - err(udevice->udev, "mknod(%s, %#o, %u, %u) failed: %s\n", - file_tmp, mode, major(devt), minor(devt), strerror(errno)); + err(udevice->udev, "mknod(%s, %#o, %u, %u) failed: %m\n", + file_tmp, mode, major(devt), minor(devt)); goto exit; } err = rename(file_tmp, file); if (err != 0) { - err(udevice->udev, "rename(%s, %s) failed: %s\n", file_tmp, file, strerror(errno)); + err(udevice->udev, "rename(%s, %s) failed: %m\n", file_tmp, file); unlink(file_tmp); } } @@ -74,8 +74,8 @@ int udev_node_mknod(struct udevice *udevice, const char *file, dev_t devt, mode_ err = mknod(file, mode, devt); udev_selinux_resetfscreatecon(udevice->udev); if (err != 0) { - err(udevice->udev, "mknod(%s, %#o, (%u,%u) failed: %s\n", - file, mode, major(devt), minor(devt), strerror(errno)); + err(udevice->udev, "mknod(%s, %#o, (%u,%u) failed: %m\n", + file, mode, major(devt), minor(devt)); goto exit; } } @@ -84,7 +84,7 @@ int udev_node_mknod(struct udevice *udevice, const char *file, dev_t devt, mode_ info(udevice->udev, "chmod(%s, %#o)\n", file, mode); err = chmod(file, mode); if (err != 0) { - err(udevice->udev, "chmod(%s, %#o) failed: %s\n", file, mode, strerror(errno)); + err(udevice->udev, "chmod(%s, %#o) failed: %m\n", file, mode); goto exit; } } @@ -93,7 +93,7 @@ int udev_node_mknod(struct udevice *udevice, const char *file, dev_t devt, mode_ info(udevice->udev, "chown(%s, %u, %u)\n", file, uid, gid); err = chown(file, uid, gid); if (err != 0) { - err(udevice->udev, "chown(%s, %u, %u) failed: %s\n", file, uid, gid, strerror(errno)); + err(udevice->udev, "chown(%s, %u, %u) failed: %m\n", file, uid, gid); goto exit; } } @@ -170,12 +170,12 @@ static int node_symlink(struct udevice *udevice, const char *node, const char *s retval = symlink(target, slink_tmp); udev_selinux_resetfscreatecon(udevice->udev); if (retval != 0) { - err(udevice->udev, "symlink(%s, %s) failed: %s\n", target, slink_tmp, strerror(errno)); + err(udevice->udev, "symlink(%s, %s) failed: %m\n", target, slink_tmp); goto exit; } retval = rename(slink_tmp, slink); if (retval != 0) { - err(udevice->udev, "rename(%s, %s) failed: %s\n", slink_tmp, slink, strerror(errno)); + err(udevice->udev, "rename(%s, %s) failed: %m\n", slink_tmp, slink); unlink(slink_tmp); goto exit; } |