Merge pull request #8802 from keszybz/errno-reform

Errno reform
This commit is contained in:
Lennart Poettering
2018-04-24 20:25:27 +02:00
committed by GitHub
10 changed files with 26 additions and 42 deletions
+3 -4
View File
@@ -82,10 +82,9 @@ bool use_audit(void) {
fd = socket(AF_NETLINK, SOCK_RAW|SOCK_CLOEXEC|SOCK_NONBLOCK, NETLINK_AUDIT);
if (fd < 0) {
cached_use = !IN_SET(errno, EAFNOSUPPORT, EPROTONOSUPPORT, EPERM);
if (errno == EPERM)
log_debug_errno(errno, "Audit access prohibited, won't talk to audit");
}
else {
if (!cached_use)
log_debug_errno(errno, "Won't talk to audit: %m");
} else {
cached_use = true;
safe_close(fd);
}
+1 -2
View File
@@ -301,8 +301,7 @@ int drop_privileges(uid_t uid, gid_t gid, uint64_t keep_capabilities) {
if (prctl(PR_SET_KEEPCAPS, 1) < 0)
return log_error_errno(errno, "Failed to enable keep capabilities flag: %m");
r = setresuid(uid, uid, uid);
if (r < 0)
if (setresuid(uid, uid, uid) < 0)
return log_error_errno(errno, "Failed to change user ID: %m");
if (prctl(PR_SET_KEEPCAPS, 0) < 0)
+2 -3
View File
@@ -686,9 +686,8 @@ int log_internalv_realm(
if (_likely_(LOG_PRI(level) > log_max_level[realm]))
return -error;
/* Make sure that %m maps to the specified error */
if (error != 0)
errno = error;
/* Make sure that %m maps to the specified error (or "Success"). */
errno = error;
(void) vsnprintf(buffer, sizeof buffer, format, ap);