diff options
author | Lennart Poettering <lennart@poettering.net> | 2018-10-18 16:14:25 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2018-10-18 16:23:45 +0200 |
commit | 9fd0b02913685fa387967c47185e0ce3696646cc (patch) | |
tree | 4923a0d7e830acf08e50ded3602137fb73ce536f /src/core | |
parent | smcak-setup: FOREACH_LINE excorcism (diff) | |
download | systemd-9fd0b02913685fa387967c47185e0ce3696646cc.tar.xz systemd-9fd0b02913685fa387967c47185e0ce3696646cc.zip |
smack-setup: include error cause in log message
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/smack-setup.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/core/smack-setup.c b/src/core/smack-setup.c index 216176145c..4aa839ea22 100644 --- a/src/core/smack-setup.c +++ b/src/core/smack-setup.c @@ -279,7 +279,8 @@ static int write_onlycap_list(void) { f = fopen("/etc/smack/onlycap", "re"); if (!f) { if (errno != ENOENT) - log_warning_errno(errno, "Failed to read '/etc/smack/onlycap'"); + log_warning_errno(errno, "Failed to read '/etc/smack/onlycap': %m"); + return errno == ENOENT ? ENOENT : -errno; } @@ -304,7 +305,7 @@ static int write_onlycap_list(void) { len += l + 1; } - if (!len) + if (len == 0) return 0; list[len - 1] = 0; @@ -312,13 +313,13 @@ static int write_onlycap_list(void) { onlycap_fd = open("/sys/fs/smackfs/onlycap", O_WRONLY|O_CLOEXEC|O_NONBLOCK|O_NOCTTY); if (onlycap_fd < 0) { if (errno != ENOENT) - log_warning_errno(errno, "Failed to open '/sys/fs/smackfs/onlycap'"); + log_warning_errno(errno, "Failed to open '/sys/fs/smackfs/onlycap': %m"); return -errno; /* negative error */ } r = write(onlycap_fd, list, len); if (r < 0) - return log_error_errno(errno, "Failed to write onlycap list(%s) to '/sys/fs/smackfs/onlycap'", list); + return log_error_errno(errno, "Failed to write onlycap list(%s) to '/sys/fs/smackfs/onlycap': %m", list); return 0; } |