summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/execute.c3
-rw-r--r--src/core/namespace.c3
-rw-r--r--src/core/shutdown.c3
-rw-r--r--src/initctl/initctl.c4
-rw-r--r--src/journal-remote/journal-remote.c3
-rw-r--r--src/journal/cat.c3
-rw-r--r--src/journal/coredumpctl.c7
-rw-r--r--src/journal/journal-verify.c10
-rw-r--r--src/journal/journalctl.c6
-rw-r--r--src/login/logind-button.c3
-rw-r--r--src/resolve/resolved-manager.c3
-rw-r--r--src/shared/ask-password-api.c19
-rw-r--r--src/shared/pager.c3
-rw-r--r--src/udev/udev-ctrl.c8
-rw-r--r--src/udev/udev-event.c6
-rw-r--r--src/update-utmp/update-utmp.c12
-rw-r--r--src/user-sessions/user-sessions.c4
17 files changed, 38 insertions, 62 deletions
diff --git a/src/core/execute.c b/src/core/execute.c
index 3e20130f0e..cd3592b847 100644
--- a/src/core/execute.c
+++ b/src/core/execute.c
@@ -928,8 +928,7 @@ fail:
log_error("PAM failed: %s", pam_strerror(handle, pam_code));
err = -EPERM; /* PAM errors do not map to errno */
} else {
- log_error_errno(errno, "PAM failed: %m");
- err = -errno;
+ err = log_error_errno(errno, "PAM failed: %m");
}
if (handle) {
diff --git a/src/core/namespace.c b/src/core/namespace.c
index 045321e1d4..0b85b859fa 100644
--- a/src/core/namespace.c
+++ b/src/core/namespace.c
@@ -288,8 +288,7 @@ static int mount_kdbus(BindMount *m) {
/* create a new /dev/null dev node copy so we have some fodder to
* bind-mount the custom endpoint over. */
if (stat("/dev/null", &st) < 0) {
- log_error_errno(errno, "Failed to stat /dev/null: %m");
- r = -errno;
+ r = log_error_errno(errno, "Failed to stat /dev/null: %m");
goto fail;
}
diff --git a/src/core/shutdown.c b/src/core/shutdown.c
index 8a6fd25f31..8cc6efc5b8 100644
--- a/src/core/shutdown.c
+++ b/src/core/shutdown.c
@@ -404,8 +404,7 @@ int main(int argc, char *argv[]) {
exit(0);
}
- log_error_errno(errno, "Failed to invoke reboot(): %m");
- r = -errno;
+ r = log_error_errno(errno, "Failed to invoke reboot(): %m");
error:
log_emergency_errno(r, "Critical error while doing system shutdown: %m");
diff --git a/src/initctl/initctl.c b/src/initctl/initctl.c
index 087cc2f7d6..6d08db74ef 100644
--- a/src/initctl/initctl.c
+++ b/src/initctl/initctl.c
@@ -269,8 +269,8 @@ static int server_init(Server *s, unsigned n_sockets) {
s->epoll_fd = epoll_create1(EPOLL_CLOEXEC);
if (s->epoll_fd < 0) {
- r = -errno;
- log_error_errno(errno, "Failed to create epoll object: %m");
+ r = log_error_errno(errno,
+ "Failed to create epoll object: %m");
goto fail;
}
diff --git a/src/journal-remote/journal-remote.c b/src/journal-remote/journal-remote.c
index cdcda1cb52..bdf01f582c 100644
--- a/src/journal-remote/journal-remote.c
+++ b/src/journal-remote/journal-remote.c
@@ -88,8 +88,7 @@ static int spawn_child(const char* child, char** argv) {
child_pid = fork();
if (child_pid < 0) {
- r = -errno;
- log_error_errno(errno, "Failed to fork: %m");
+ r = log_error_errno(errno, "Failed to fork: %m");
safe_close_pair(fd);
return r;
}
diff --git a/src/journal/cat.c b/src/journal/cat.c
index 2e236f0004..be2c2e3354 100644
--- a/src/journal/cat.c
+++ b/src/journal/cat.c
@@ -142,8 +142,7 @@ int main(int argc, char *argv[]) {
if (dup3(fd, STDOUT_FILENO, 0) < 0 ||
dup3(fd, STDERR_FILENO, 0) < 0) {
- log_error_errno(errno, "Failed to duplicate fd: %m");
- r = -errno;
+ r = log_error_errno(errno, "Failed to duplicate fd: %m");
goto finish;
}
diff --git a/src/journal/coredumpctl.c b/src/journal/coredumpctl.c
index 644ba91b0d..0fa427003b 100644
--- a/src/journal/coredumpctl.c
+++ b/src/journal/coredumpctl.c
@@ -631,8 +631,8 @@ static int save_core(sd_journal *j, int fd, char **path, bool *unlink_temp) {
sz = write(fdt, data, len);
if (sz < 0) {
- log_error_errno(errno, "Failed to write temporary file: %m");
- r = -errno;
+ r = log_error_errno(errno,
+ "Failed to write temporary file: %m");
goto error;
}
if (sz != (ssize_t) len) {
@@ -758,8 +758,7 @@ static int run_gdb(sd_journal *j) {
pid = fork();
if (pid < 0) {
- log_error_errno(errno, "Failed to fork(): %m");
- r = -errno;
+ r = log_error_errno(errno, "Failed to fork(): %m");
goto finish;
}
if (pid == 0) {
diff --git a/src/journal/journal-verify.c b/src/journal/journal-verify.c
index eaf006db7a..00f70d3a53 100644
--- a/src/journal/journal-verify.c
+++ b/src/journal/journal-verify.c
@@ -839,22 +839,20 @@ int journal_file_verify(
data_fd = open_tmpfile("/var/tmp", O_RDWR | O_CLOEXEC);
if (data_fd < 0) {
- log_error_errno(errno, "Failed to create data file: %m");
- r = -errno;
+ r = log_error_errno(errno, "Failed to create data file: %m");
goto fail;
}
entry_fd = open_tmpfile("/var/tmp", O_RDWR | O_CLOEXEC);
if (entry_fd < 0) {
- log_error_errno(errno, "Failed to create entry file: %m");
- r = -errno;
+ r = log_error_errno(errno, "Failed to create entry file: %m");
goto fail;
}
entry_array_fd = open_tmpfile("/var/tmp", O_RDWR | O_CLOEXEC);
if (entry_array_fd < 0) {
- log_error_errno(errno, "Failed to create entry array file: %m");
- r = -errno;
+ r = log_error_errno(errno,
+ "Failed to create entry array file: %m");
goto fail;
}
diff --git a/src/journal/journalctl.c b/src/journal/journalctl.c
index ce2dd9da26..d31ab1c6d7 100644
--- a/src/journal/journalctl.c
+++ b/src/journal/journalctl.c
@@ -1428,8 +1428,7 @@ static int setup_keys(void) {
fd = open("/dev/random", O_RDONLY|O_CLOEXEC|O_NOCTTY);
if (fd < 0) {
- log_error_errno(errno, "Failed to open /dev/random: %m");
- r = -errno;
+ r = log_error_errno(errno, "Failed to open /dev/random: %m");
goto finish;
}
@@ -1488,8 +1487,7 @@ static int setup_keys(void) {
}
if (link(k, p) < 0) {
- log_error_errno(errno, "Failed to link file: %m");
- r = -errno;
+ r = log_error_errno(errno, "Failed to link file: %m");
goto finish;
}
diff --git a/src/login/logind-button.c b/src/login/logind-button.c
index 92c1b67951..cc98f5450e 100644
--- a/src/login/logind-button.c
+++ b/src/login/logind-button.c
@@ -248,8 +248,7 @@ int button_open(Button *b) {
return log_warning_errno(errno, "Failed to open %s: %m", b->name);
if (ioctl(b->fd, EVIOCGNAME(sizeof(name)), name) < 0) {
- log_error_errno(errno, "Failed to get input name: %m");
- r = -errno;
+ r = log_error_errno(errno, "Failed to get input name: %m");
goto fail;
}
diff --git a/src/resolve/resolved-manager.c b/src/resolve/resolved-manager.c
index 13852192c4..de924e3ed9 100644
--- a/src/resolve/resolved-manager.c
+++ b/src/resolve/resolved-manager.c
@@ -619,8 +619,7 @@ int manager_read_resolv_conf(Manager *m) {
}
if (fstat(fileno(f), &st) < 0) {
- log_error_errno(errno, "Failed to stat open file: %m");
- r = -errno;
+ r = log_error_errno(errno, "Failed to stat open file: %m");
goto clear;
}
diff --git a/src/shared/ask-password-api.c b/src/shared/ask-password-api.c
index ca4c24ebde..f5cff6fc56 100644
--- a/src/shared/ask-password-api.c
+++ b/src/shared/ask-password-api.c
@@ -331,8 +331,8 @@ int ask_password_agent(
fd = mkostemp_safe(temp, O_WRONLY|O_CLOEXEC);
if (fd < 0) {
- log_error_errno(errno, "Failed to create password file: %m");
- r = -errno;
+ r = log_error_errno(errno,
+ "Failed to create password file: %m");
goto finish;
}
@@ -340,8 +340,7 @@ int ask_password_agent(
f = fdopen(fd, "w");
if (!f) {
- log_error_errno(errno, "Failed to allocate FILE: %m");
- r = -errno;
+ r = log_error_errno(errno, "Failed to allocate FILE: %m");
goto finish;
}
@@ -349,8 +348,7 @@ int ask_password_agent(
signal_fd = signalfd(-1, &mask, SFD_NONBLOCK|SFD_CLOEXEC);
if (signal_fd < 0) {
- log_error_errno(errno, "signalfd(): %m");
- r = -errno;
+ r = log_error_errno(errno, "signalfd(): %m");
goto finish;
}
@@ -395,8 +393,7 @@ int ask_password_agent(
final[sizeof(final)-9] = 'k';
if (rename(temp, final) < 0) {
- log_error_errno(errno, "Failed to rename query file: %m");
- r = -errno;
+ r = log_error_errno(errno, "Failed to rename query file: %m");
goto finish;
}
@@ -432,8 +429,7 @@ int ask_password_agent(
if (errno == EINTR)
continue;
- log_error_errno(errno, "poll() failed: %m");
- r = -errno;
+ r = log_error_errno(errno, "poll() failed: %m");
goto finish;
}
@@ -471,8 +467,7 @@ int ask_password_agent(
errno == EINTR)
continue;
- log_error_errno(errno, "recvmsg() failed: %m");
- r = -errno;
+ r = log_error_errno(errno, "recvmsg() failed: %m");
goto finish;
}
diff --git a/src/shared/pager.c b/src/shared/pager.c
index 3992f9c837..55fd5cb79e 100644
--- a/src/shared/pager.c
+++ b/src/shared/pager.c
@@ -74,8 +74,7 @@ int pager_open(bool jump_to_end) {
pager_pid = fork();
if (pager_pid < 0) {
- r = -errno;
- log_error_errno(errno, "Failed to fork pager: %m");
+ r = log_error_errno(errno, "Failed to fork pager: %m");
safe_close_pair(fd);
return r;
}
diff --git a/src/udev/udev-ctrl.c b/src/udev/udev-ctrl.c
index ead7c92b27..12bc6029b3 100644
--- a/src/udev/udev-ctrl.c
+++ b/src/udev/udev-ctrl.c
@@ -122,16 +122,12 @@ int udev_ctrl_enable_receiving(struct udev_ctrl *uctrl) {
}
if (err < 0) {
- err = -errno;
- log_error_errno(errno, "bind failed: %m");
- return err;
+ return log_error_errno(errno, "bind failed: %m");
}
err = listen(uctrl->sock, 0);
if (err < 0) {
- err = -errno;
- log_error_errno(errno, "listen failed: %m");
- return err;
+ return log_error_errno(errno, "listen failed: %m");
}
uctrl->bound = true;
diff --git a/src/udev/udev-event.c b/src/udev/udev-event.c
index 8ba6aed00e..1e34cbc2f5 100644
--- a/src/udev/udev-event.c
+++ b/src/udev/udev-event.c
@@ -731,15 +731,13 @@ int udev_event_spawn(struct udev_event *event,
/* pipes from child to parent */
if (result != NULL || log_get_max_level() >= LOG_INFO) {
if (pipe2(outpipe, O_NONBLOCK) != 0) {
- err = -errno;
- log_error_errno(errno, "pipe failed: %m");
+ err = log_error_errno(errno, "pipe failed: %m");
goto out;
}
}
if (log_get_max_level() >= LOG_INFO) {
if (pipe2(errpipe, O_NONBLOCK) != 0) {
- err = -errno;
- log_error_errno(errno, "pipe failed: %m");
+ err = log_error_errno(errno, "pipe failed: %m");
goto out;
}
}
diff --git a/src/update-utmp/update-utmp.c b/src/update-utmp/update-utmp.c
index 61bcf02b2f..a91c335381 100644
--- a/src/update-utmp/update-utmp.c
+++ b/src/update-utmp/update-utmp.c
@@ -130,8 +130,8 @@ static int on_reboot(Context *c) {
if (c->audit_fd >= 0)
if (audit_log_user_comm_message(c->audit_fd, AUDIT_SYSTEM_BOOT, "", "systemd-update-utmp", NULL, NULL, NULL, 1) < 0 &&
errno != EPERM) {
- log_error_errno(errno, "Failed to send audit message: %m");
- r = -errno;
+ r = log_error_errno(errno,
+ "Failed to send audit message: %m");
}
#endif
@@ -160,8 +160,8 @@ static int on_shutdown(Context *c) {
if (c->audit_fd >= 0)
if (audit_log_user_comm_message(c->audit_fd, AUDIT_SYSTEM_SHUTDOWN, "", "systemd-update-utmp", NULL, NULL, NULL, 1) < 0 &&
errno != EPERM) {
- log_error_errno(errno, "Failed to send audit message: %m");
- r = -errno;
+ r = log_error_errno(errno,
+ "Failed to send audit message: %m");
}
#endif
@@ -212,8 +212,8 @@ static int on_runlevel(Context *c) {
if (audit_log_user_comm_message(c->audit_fd, AUDIT_SYSTEM_RUNLEVEL, s, "systemd-update-utmp", NULL, NULL, NULL, 1) < 0 &&
errno != EPERM) {
- log_error_errno(errno, "Failed to send audit message: %m");
- r = -errno;
+ r = log_error_errno(errno,
+ "Failed to send audit message: %m");
}
}
#endif
diff --git a/src/user-sessions/user-sessions.c b/src/user-sessions/user-sessions.c
index e80a7771de..4dd4e87b86 100644
--- a/src/user-sessions/user-sessions.c
+++ b/src/user-sessions/user-sessions.c
@@ -43,8 +43,8 @@ int main(int argc, char*argv[]) {
int r = 0;
if (unlink("/run/nologin") < 0 && errno != ENOENT) {
- log_error_errno(errno, "Failed to remove /run/nologin file: %m");
- r = -errno;
+ r = log_error_errno(errno,
+ "Failed to remove /run/nologin file: %m");
}
if (unlink("/etc/nologin") < 0 && errno != ENOENT) {