summaryrefslogtreecommitdiff
path: root/src/shared
diff options
context:
space:
mode:
authorMichal Schmidt <mschmidt@redhat.com>2014-11-28 13:19:16 +0100
committerMichal Schmidt <mschmidt@redhat.com>2014-11-28 13:29:21 +0100
commitda927ba997d68401563b927f92e6e40e021a8e5c (patch)
tree71764cd998aef07b8943c5206c9307a93ba9c528 /src/shared
parent0a1beeb64207eaa88ab9236787b1cbc2f704ae14 (diff)
treewide: no need to negate errno for log_*_errno()
It corrrectly handles both positive and negative errno values.
Diffstat (limited to 'src/shared')
-rw-r--r--src/shared/capability.c2
-rw-r--r--src/shared/generator.c4
-rw-r--r--src/shared/install.c2
-rw-r--r--src/shared/logs-show.c28
-rw-r--r--src/shared/pager.c2
-rw-r--r--src/shared/sleep-config.c2
-rw-r--r--src/shared/socket-label.c4
-rw-r--r--src/shared/socket-util.c2
-rw-r--r--src/shared/spawn-ask-password-agent.c2
-rw-r--r--src/shared/spawn-polkit-agent.c2
-rw-r--r--src/shared/util.c8
11 files changed, 29 insertions, 29 deletions
diff --git a/src/shared/capability.c b/src/shared/capability.c
index f7513379a2..89e61430b0 100644
--- a/src/shared/capability.c
+++ b/src/shared/capability.c
@@ -255,7 +255,7 @@ int drop_privileges(uid_t uid, gid_t gid, uint64_t keep_capabilities) {
r = capability_bounding_set_drop(~keep_capabilities, true);
if (r < 0) {
- log_error_errno(-r, "Failed to drop capabilities: %m");
+ log_error_errno(r, "Failed to drop capabilities: %m");
return r;
}
diff --git a/src/shared/generator.c b/src/shared/generator.c
index 892fa39ec1..f54bb06f68 100644
--- a/src/shared/generator.c
+++ b/src/shared/generator.c
@@ -52,10 +52,10 @@ int generator_write_fsck_deps(
r = fsck_exists(fstype);
if (r == -ENOENT) {
/* treat missing check as essentially OK */
- log_debug_errno(-r, "Checking was requested for %s, but fsck.%s does not exist: %m", what, fstype);
+ log_debug_errno(r, "Checking was requested for %s, but fsck.%s does not exist: %m", what, fstype);
return 0;
} else if (r < 0) {
- log_warning_errno(-r, "Checking was requested for %s, but fsck.%s cannot be used: %m", what, fstype);
+ log_warning_errno(r, "Checking was requested for %s, but fsck.%s cannot be used: %m", what, fstype);
return r;
}
}
diff --git a/src/shared/install.c b/src/shared/install.c
index 1e90bdf725..9094662dfc 100644
--- a/src/shared/install.c
+++ b/src/shared/install.c
@@ -1554,7 +1554,7 @@ int unit_file_add_dependency(
state = unit_file_get_state(scope, root_dir, *i);
if (state < 0) {
- log_error_errno(-state, "Failed to get unit file state for %s: %m", *i);
+ log_error_errno(state, "Failed to get unit file state for %s: %m", *i);
return state;
}
diff --git a/src/shared/logs-show.c b/src/shared/logs-show.c
index 32eba6ccfe..eb15eeac88 100644
--- a/src/shared/logs-show.c
+++ b/src/shared/logs-show.c
@@ -296,7 +296,7 @@ static int output_short(
r = sd_journal_get_monotonic_usec(j, &t, &boot_id);
if (r < 0) {
- log_error_errno(-r, "Failed to get monotonic timestamp: %m");
+ log_error_errno(r, "Failed to get monotonic timestamp: %m");
return r;
}
@@ -323,7 +323,7 @@ static int output_short(
r = sd_journal_get_realtime_usec(j, &x);
if (r < 0) {
- log_error_errno(-r, "Failed to get realtime timestamp: %m");
+ log_error_errno(r, "Failed to get realtime timestamp: %m");
return r;
}
@@ -422,7 +422,7 @@ static int output_verbose(
r = parse_field(data, length, "_SOURCE_REALTIME_TIMESTAMP=", &value, &size);
if (r < 0)
- log_debug_errno(-r, "_SOURCE_REALTIME_TIMESTAMP invalid: %m");
+ log_debug_errno(r, "_SOURCE_REALTIME_TIMESTAMP invalid: %m");
else {
r = safe_atou64(value, &realtime);
if (r < 0)
@@ -442,7 +442,7 @@ static int output_verbose(
r = sd_journal_get_cursor(j, &cursor);
if (r < 0) {
- log_error_errno(-r, "Failed to get cursor: %m");
+ log_error_errno(r, "Failed to get cursor: %m");
return r;
}
@@ -517,19 +517,19 @@ static int output_export(
r = sd_journal_get_realtime_usec(j, &realtime);
if (r < 0) {
- log_error_errno(-r, "Failed to get realtime timestamp: %m");
+ log_error_errno(r, "Failed to get realtime timestamp: %m");
return r;
}
r = sd_journal_get_monotonic_usec(j, &monotonic, &boot_id);
if (r < 0) {
- log_error_errno(-r, "Failed to get monotonic timestamp: %m");
+ log_error_errno(r, "Failed to get monotonic timestamp: %m");
return r;
}
r = sd_journal_get_cursor(j, &cursor);
if (r < 0) {
- log_error_errno(-r, "Failed to get cursor: %m");
+ log_error_errno(r, "Failed to get cursor: %m");
return r;
}
@@ -657,19 +657,19 @@ static int output_json(
r = sd_journal_get_realtime_usec(j, &realtime);
if (r < 0) {
- log_error_errno(-r, "Failed to get realtime timestamp: %m");
+ log_error_errno(r, "Failed to get realtime timestamp: %m");
return r;
}
r = sd_journal_get_monotonic_usec(j, &monotonic, &boot_id);
if (r < 0) {
- log_error_errno(-r, "Failed to get monotonic timestamp: %m");
+ log_error_errno(r, "Failed to get monotonic timestamp: %m");
return r;
}
r = sd_journal_get_cursor(j, &cursor);
if (r < 0) {
- log_error_errno(-r, "Failed to get cursor: %m");
+ log_error_errno(r, "Failed to get cursor: %m");
return r;
}
@@ -877,7 +877,7 @@ static int output_cat(
if (r == -ENOENT)
return 0;
- log_error_errno(-r, "Failed to get data: %m");
+ log_error_errno(r, "Failed to get data: %m");
return r;
}
@@ -1226,13 +1226,13 @@ int add_match_this_boot(sd_journal *j, const char *machine) {
if (machine) {
r = get_boot_id_for_machine(machine, &boot_id);
if (r < 0) {
- log_error_errno(-r, "Failed to get boot id of container %s: %m", machine);
+ log_error_errno(r, "Failed to get boot id of container %s: %m", machine);
return r;
}
} else {
r = sd_id128_get_boot(&boot_id);
if (r < 0) {
- log_error_errno(-r, "Failed to get boot id: %m");
+ log_error_errno(r, "Failed to get boot id: %m");
return r;
}
}
@@ -1240,7 +1240,7 @@ int add_match_this_boot(sd_journal *j, const char *machine) {
sd_id128_to_string(boot_id, match + 9);
r = sd_journal_add_match(j, match, strlen(match));
if (r < 0) {
- log_error_errno(-r, "Failed to add match: %m");
+ log_error_errno(r, "Failed to add match: %m");
return r;
}
diff --git a/src/shared/pager.c b/src/shared/pager.c
index 572c26b149..aa74bab103 100644
--- a/src/shared/pager.c
+++ b/src/shared/pager.c
@@ -186,7 +186,7 @@ int show_man_page(const char *desc, bool null_stdio) {
if (null_stdio) {
r = make_null_stdio();
if (r < 0) {
- log_error_errno(-r, "Failed to kill stdio: %m");
+ log_error_errno(r, "Failed to kill stdio: %m");
_exit(EXIT_FAILURE);
}
}
diff --git a/src/shared/sleep-config.c b/src/shared/sleep-config.c
index 7a4e5cda2b..e6157f0e94 100644
--- a/src/shared/sleep-config.c
+++ b/src/shared/sleep-config.c
@@ -227,7 +227,7 @@ static bool enough_memory_for_hibernation(void) {
r = get_status_field("/proc/meminfo", "\nActive(anon):", &active);
if (r < 0) {
- log_error_errno(-r, "Failed to retrieve Active(anon) from /proc/meminfo: %m");
+ log_error_errno(r, "Failed to retrieve Active(anon) from /proc/meminfo: %m");
return false;
}
diff --git a/src/shared/socket-label.c b/src/shared/socket-label.c
index b0fca9b45c..7a03ac0c51 100644
--- a/src/shared/socket-label.c
+++ b/src/shared/socket-label.c
@@ -162,12 +162,12 @@ int make_socket_fd(int log_level, const char* address, int flags) {
r = socket_address_print(&a, &p);
if (r < 0) {
- log_error_errno(-r, "socket_address_print(): %m");
+ log_error_errno(r, "socket_address_print(): %m");
return r;
}
if (fd < 0)
- log_error_errno(-fd, "Failed to listen on %s: %m", p);
+ log_error_errno(fd, "Failed to listen on %s: %m", p);
else
log_full(log_level, "Listening on %s", p);
}
diff --git a/src/shared/socket-util.c b/src/shared/socket-util.c
index 4457e9d1a2..6ef68fce09 100644
--- a/src/shared/socket-util.c
+++ b/src/shared/socket-util.c
@@ -637,7 +637,7 @@ int socknameinfo_pretty(union sockaddr_union *sa, socklen_t salen, char **_ret)
r = sockaddr_pretty(&sa->sa, salen, true, &ret);
if (r < 0) {
- log_error_errno(-r, "sockadd_pretty() failed: %m");
+ log_error_errno(r, "sockadd_pretty() failed: %m");
return r;
}
diff --git a/src/shared/spawn-ask-password-agent.c b/src/shared/spawn-ask-password-agent.c
index 6e31d8d138..ee267833e6 100644
--- a/src/shared/spawn-ask-password-agent.c
+++ b/src/shared/spawn-ask-password-agent.c
@@ -49,7 +49,7 @@ int ask_password_agent_open(void) {
SYSTEMD_TTY_ASK_PASSWORD_AGENT_BINARY_PATH,
SYSTEMD_TTY_ASK_PASSWORD_AGENT_BINARY_PATH, "--watch", NULL);
if (r < 0)
- log_error_errno(-r, "Failed to fork TTY ask password agent: %m");
+ log_error_errno(r, "Failed to fork TTY ask password agent: %m");
return r;
}
diff --git a/src/shared/spawn-polkit-agent.c b/src/shared/spawn-polkit-agent.c
index 93652f052d..e7419b5ee4 100644
--- a/src/shared/spawn-polkit-agent.c
+++ b/src/shared/spawn-polkit-agent.c
@@ -64,7 +64,7 @@ int polkit_agent_open(void) {
safe_close(pipe_fd[1]);
if (r < 0)
- log_error_errno(-r, "Failed to fork TTY ask password agent: %m");
+ log_error_errno(r, "Failed to fork TTY ask password agent: %m");
else
/* Wait until the agent closes the fd */
fd_wait_for_event(pipe_fd[0], POLLHUP, USEC_INFINITY);
diff --git a/src/shared/util.c b/src/shared/util.c
index 11be757c2f..646787cd79 100644
--- a/src/shared/util.c
+++ b/src/shared/util.c
@@ -2214,7 +2214,7 @@ int acquire_terminal(
r = reset_terminal_fd(fd, true);
if (r < 0)
- log_warning_errno(-r, "Failed to reset terminal: %m");
+ log_warning_errno(r, "Failed to reset terminal: %m");
return fd;
@@ -3796,7 +3796,7 @@ int wait_for_terminate_and_warn(const char *name, pid_t pid) {
r = wait_for_terminate(pid, &status);
if (r < 0) {
- log_warning_errno(-r, "Failed to wait for %s: %m", name);
+ log_warning_errno(r, "Failed to wait for %s: %m", name);
return r;
}
@@ -5507,13 +5507,13 @@ int make_console_stdio(void) {
fd = acquire_terminal("/dev/console", false, true, true, USEC_INFINITY);
if (fd < 0) {
- log_error_errno(-fd, "Failed to acquire terminal: %m");
+ log_error_errno(fd, "Failed to acquire terminal: %m");
return fd;
}
r = make_stdio(fd);
if (r < 0) {
- log_error_errno(-r, "Failed to duplicate terminal fd: %m");
+ log_error_errno(r, "Failed to duplicate terminal fd: %m");
return r;
}