summaryrefslogtreecommitdiff
path: root/src/core
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/core
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/core')
-rw-r--r--src/core/smack-setup.c9
-rw-r--r--src/core/socket.c3
2 files changed, 5 insertions, 7 deletions
diff --git a/src/core/smack-setup.c b/src/core/smack-setup.c
index cbe7d0b4a9..6618aa501d 100644
--- a/src/core/smack-setup.c
+++ b/src/core/smack-setup.c
@@ -215,16 +215,14 @@ int mac_smack_setup(bool *loaded_policy) {
log_info("Successfully loaded Smack policies.");
break;
default:
- log_warning("Failed to load Smack access rules: %s, ignoring.",
- strerror(abs(r)));
+ log_warning_errno(r, "Failed to load Smack access rules, ignoring: %m");
return 0;
}
#ifdef SMACK_RUN_LABEL
r = write_string_file("/proc/self/attr/current", SMACK_RUN_LABEL, 0);
if (r)
- log_warning("Failed to set SMACK label \"%s\" on self: %s",
- SMACK_RUN_LABEL, strerror(-r));
+ log_warning_errno("Failed to set SMACK label \"%s\" on self: %m", SMACK_RUN_LABEL);
#endif
r = write_cipso2_rules("/etc/smack/cipso.d/");
@@ -239,8 +237,7 @@ int mac_smack_setup(bool *loaded_policy) {
log_info("Successfully loaded Smack/CIPSO policies.");
break;
default:
- log_warning("Failed to load Smack/CIPSO access rules: %s, ignoring.",
- strerror(abs(r)));
+ log_warning_errno(r, "Failed to load Smack/CIPSO access rules, ignoring: %m");
return 0;
}
diff --git a/src/core/socket.c b/src/core/socket.c
index 0025054122..a46c422a78 100644
--- a/src/core/socket.c
+++ b/src/core/socket.c
@@ -643,7 +643,8 @@ static void socket_dump(Unit *u, FILE *f, const char *prefix) {
int r;
char *k = NULL;
- if ((r = socket_address_print(&p->address, &k)) < 0)
+ r = socket_address_print(&p->address, &k);
+ if (r < 0)
t = strerror(-r);
else
t = k;