summaryrefslogtreecommitdiff
path: root/src/basic
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-09-30 22:16:17 +0200
committerLennart Poettering <lennart@poettering.net>2015-09-30 22:26:16 +0200
commite53fc357a9bb9d0a5362ccc4246d598cb0febd5e (patch)
tree3bb6c3be9ba053e4a280b6c2ae8cd03be8f1ac6d /src/basic
parent618234a5258768359cb1086b152c5f08aaf89754 (diff)
tree-wide: remove a number of invocations of strerror() and replace by %m
Let's clean up our tree a bit, and reduce invocations of the thread-unsafe strerror() by replacing it with printf()'s %m specifier.
Diffstat (limited to 'src/basic')
-rw-r--r--src/basic/socket-label.c7
-rw-r--r--src/basic/util.c8
2 files changed, 5 insertions, 10 deletions
diff --git a/src/basic/socket-label.c b/src/basic/socket-label.c
index 144e6fd86e..937124cc02 100644
--- a/src/basic/socket-label.c
+++ b/src/basic/socket-label.c
@@ -146,11 +146,8 @@ int make_socket_fd(int log_level, const char* address, int flags) {
int fd, r;
r = socket_address_parse(&a, address);
- if (r < 0) {
- log_error("Failed to parse socket address \"%s\": %s",
- address, strerror(-r));
- return r;
- }
+ if (r < 0)
+ return log_error_errno(r, "Failed to parse socket address \"%s\": %m", address);
fd = socket_address_listen(&a, flags, SOMAXCONN, SOCKET_ADDRESS_DEFAULT,
NULL, false, false, false, 0755, 0644, NULL);
diff --git a/src/basic/util.c b/src/basic/util.c
index 33dc410c78..c63ec0ceb0 100644
--- a/src/basic/util.c
+++ b/src/basic/util.c
@@ -5344,15 +5344,13 @@ int update_reboot_param_file(const char *param) {
int r = 0;
if (param) {
-
r = write_string_file(REBOOT_PARAM_FILE, param, WRITE_STRING_FILE_CREATE);
if (r < 0)
- log_error("Failed to write reboot param to "
- REBOOT_PARAM_FILE": %s", strerror(-r));
+ return log_error_errno(r, "Failed to write reboot param to "REBOOT_PARAM_FILE": %m");
} else
- unlink(REBOOT_PARAM_FILE);
+ (void) unlink(REBOOT_PARAM_FILE);
- return r;
+ return 0;
}
int umount_recursive(const char *prefix, int flags) {