summaryrefslogtreecommitdiff
path: root/src/libsystemd/sd-bus
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/libsystemd/sd-bus
parent0a1beeb64207eaa88ab9236787b1cbc2f704ae14 (diff)
treewide: no need to negate errno for log_*_errno()
It corrrectly handles both positive and negative errno values.
Diffstat (limited to 'src/libsystemd/sd-bus')
-rw-r--r--src/libsystemd/sd-bus/bus-dump.c10
-rw-r--r--src/libsystemd/sd-bus/bus-kernel.c4
-rw-r--r--src/libsystemd/sd-bus/bus-track.c2
-rw-r--r--src/libsystemd/sd-bus/bus-util.c4
-rw-r--r--src/libsystemd/sd-bus/busctl.c36
-rw-r--r--src/libsystemd/sd-bus/test-bus-chat.c66
-rw-r--r--src/libsystemd/sd-bus/test-bus-objects.c4
-rw-r--r--src/libsystemd/sd-bus/test-bus-server.c12
8 files changed, 69 insertions, 69 deletions
diff --git a/src/libsystemd/sd-bus/bus-dump.c b/src/libsystemd/sd-bus/bus-dump.c
index 54716bd904..b57ac41e05 100644
--- a/src/libsystemd/sd-bus/bus-dump.c
+++ b/src/libsystemd/sd-bus/bus-dump.c
@@ -126,7 +126,7 @@ int bus_message_dump(sd_bus_message *m, FILE *f, unsigned flags) {
r = sd_bus_message_rewind(m, !(flags & BUS_MESSAGE_DUMP_SUBTREE_ONLY));
if (r < 0) {
- log_error_errno(-r, "Failed to rewind: %m");
+ log_error_errno(r, "Failed to rewind: %m");
return r;
}
@@ -152,7 +152,7 @@ int bus_message_dump(sd_bus_message *m, FILE *f, unsigned flags) {
r = sd_bus_message_peek_type(m, &type, &contents);
if (r < 0) {
- log_error_errno(-r, "Failed to peek type: %m");
+ log_error_errno(r, "Failed to peek type: %m");
return r;
}
@@ -162,7 +162,7 @@ int bus_message_dump(sd_bus_message *m, FILE *f, unsigned flags) {
r = sd_bus_message_exit_container(m);
if (r < 0) {
- log_error_errno(-r, "Failed to exit container: %m");
+ log_error_errno(r, "Failed to exit container: %m");
return r;
}
@@ -183,7 +183,7 @@ int bus_message_dump(sd_bus_message *m, FILE *f, unsigned flags) {
if (bus_type_is_container(type) > 0) {
r = sd_bus_message_enter_container(m, type, contents);
if (r < 0) {
- log_error_errno(-r, "Failed to enter container: %m");
+ log_error_errno(r, "Failed to enter container: %m");
return r;
}
@@ -203,7 +203,7 @@ int bus_message_dump(sd_bus_message *m, FILE *f, unsigned flags) {
r = sd_bus_message_read_basic(m, type, &basic);
if (r < 0) {
- log_error_errno(-r, "Failed to get basic: %m");
+ log_error_errno(r, "Failed to get basic: %m");
return r;
}
diff --git a/src/libsystemd/sd-bus/bus-kernel.c b/src/libsystemd/sd-bus/bus-kernel.c
index fe150ccdae..5b4bbfd1ea 100644
--- a/src/libsystemd/sd-bus/bus-kernel.c
+++ b/src/libsystemd/sd-bus/bus-kernel.c
@@ -1059,7 +1059,7 @@ int bus_kernel_write_message(sd_bus *bus, sd_bus_message *m, bool hint_sync_call
/* Anybody can send us invalid messages, let's just drop them. */
if (r == -EBADMSG || r == -EPROTOTYPE)
- log_debug_errno(-r, "Ignoring invalid message: %m");
+ log_debug_errno(r, "Ignoring invalid message: %m");
else
return r;
}
@@ -1243,7 +1243,7 @@ int bus_kernel_read_message(sd_bus *bus, bool hint_priority, int64_t priority) {
/* Anybody can send us invalid messages, let's just drop them. */
if (r == -EBADMSG || r == -EPROTOTYPE) {
- log_debug_errno(-r, "Ignoring invalid message: %m");
+ log_debug_errno(r, "Ignoring invalid message: %m");
r = 0;
}
diff --git a/src/libsystemd/sd-bus/bus-track.c b/src/libsystemd/sd-bus/bus-track.c
index 0b2f2a9059..6be8310bbe 100644
--- a/src/libsystemd/sd-bus/bus-track.c
+++ b/src/libsystemd/sd-bus/bus-track.c
@@ -309,7 +309,7 @@ void bus_track_dispatch(sd_bus_track *track) {
r = track->handler(track, track->userdata);
if (r < 0)
- log_debug_errno(-r, "Failed to process track handler: %m");
+ log_debug_errno(r, "Failed to process track handler: %m");
else if (r == 0)
bus_track_add_to_queue(track);
diff --git a/src/libsystemd/sd-bus/bus-util.c b/src/libsystemd/sd-bus/bus-util.c
index 4b5c1a6d36..22a3766a02 100644
--- a/src/libsystemd/sd-bus/bus-util.c
+++ b/src/libsystemd/sd-bus/bus-util.c
@@ -1263,12 +1263,12 @@ int bus_property_get_ulong(
#endif
int bus_log_parse_error(int r) {
- log_error_errno(-r, "Failed to parse bus message: %m");
+ log_error_errno(r, "Failed to parse bus message: %m");
return r;
}
int bus_log_create_error(int r) {
- log_error_errno(-r, "Failed to create bus message: %m");
+ log_error_errno(r, "Failed to create bus message: %m");
return r;
}
diff --git a/src/libsystemd/sd-bus/busctl.c b/src/libsystemd/sd-bus/busctl.c
index 8cc309c01b..b4a91dfed3 100644
--- a/src/libsystemd/sd-bus/busctl.c
+++ b/src/libsystemd/sd-bus/busctl.c
@@ -90,7 +90,7 @@ static int list_bus_names(sd_bus *bus, char **argv) {
r = sd_bus_list_names(bus, (arg_acquired || arg_unique) ? &acquired : NULL, arg_activatable ? &activatable : NULL);
if (r < 0) {
- log_error_errno(-r, "Failed to list names: %m");
+ log_error_errno(r, "Failed to list names: %m");
return r;
}
@@ -105,7 +105,7 @@ static int list_bus_names(sd_bus *bus, char **argv) {
r = hashmap_put(names, *i, NAME_IS_ACQUIRED);
if (r < 0) {
- log_error_errno(-r, "Failed to add to hashmap: %m");
+ log_error_errno(r, "Failed to add to hashmap: %m");
return r;
}
}
@@ -115,7 +115,7 @@ static int list_bus_names(sd_bus *bus, char **argv) {
r = hashmap_put(names, *i, NAME_IS_ACTIVATABLE);
if (r < 0 && r != -EEXIST) {
- log_error_errno(-r, "Failed to add to hashmap: %m");
+ log_error_errno(r, "Failed to add to hashmap: %m");
return r;
}
}
@@ -439,7 +439,7 @@ static int tree(sd_bus *bus, char **argv) {
r = sd_bus_list_names(bus, &names, NULL);
if (r < 0) {
- log_error_errno(-r, "Failed to get name list: %m");
+ log_error_errno(r, "Failed to get name list: %m");
return r;
}
@@ -1096,7 +1096,7 @@ static int monitor(sd_bus *bus, char *argv[], int (*dump)(sd_bus_message *m, FIL
r = sd_bus_add_match(bus, NULL, m, NULL, NULL);
if (r < 0) {
- log_error_errno(-r, "Failed to add match: %m");
+ log_error_errno(r, "Failed to add match: %m");
return r;
}
@@ -1106,7 +1106,7 @@ static int monitor(sd_bus *bus, char *argv[], int (*dump)(sd_bus_message *m, FIL
STRV_FOREACH(i, arg_matches) {
r = sd_bus_add_match(bus, NULL, *i, NULL, NULL);
if (r < 0) {
- log_error_errno(-r, "Failed to add match: %m");
+ log_error_errno(r, "Failed to add match: %m");
return r;
}
@@ -1116,7 +1116,7 @@ static int monitor(sd_bus *bus, char *argv[], int (*dump)(sd_bus_message *m, FIL
if (!added_something) {
r = sd_bus_add_match(bus, NULL, "", NULL, NULL);
if (r < 0) {
- log_error_errno(-r, "Failed to add match: %m");
+ log_error_errno(r, "Failed to add match: %m");
return r;
}
}
@@ -1126,7 +1126,7 @@ static int monitor(sd_bus *bus, char *argv[], int (*dump)(sd_bus_message *m, FIL
r = sd_bus_process(bus, &m);
if (r < 0) {
- log_error_errno(-r, "Failed to process bus: %m");
+ log_error_errno(r, "Failed to process bus: %m");
return r;
}
@@ -1140,7 +1140,7 @@ static int monitor(sd_bus *bus, char *argv[], int (*dump)(sd_bus_message *m, FIL
r = sd_bus_wait(bus, (uint64_t) -1);
if (r < 0) {
- log_error_errno(-r, "Failed to wait for bus: %m");
+ log_error_errno(r, "Failed to wait for bus: %m");
return r;
}
}
@@ -1200,7 +1200,7 @@ static int status(sd_bus *bus, char *argv[]) {
&creds);
if (r < 0) {
- log_error_errno(-r, "Failed to get credentials: %m");
+ log_error_errno(r, "Failed to get credentials: %m");
return r;
}
@@ -1962,7 +1962,7 @@ int main(int argc, char *argv[]) {
r = sd_bus_new(&bus);
if (r < 0) {
- log_error_errno(-r, "Failed to allocate bus: %m");
+ log_error_errno(r, "Failed to allocate bus: %m");
goto finish;
}
@@ -1971,25 +1971,25 @@ int main(int argc, char *argv[]) {
r = sd_bus_set_monitor(bus, true);
if (r < 0) {
- log_error_errno(-r, "Failed to set monitor mode: %m");
+ log_error_errno(r, "Failed to set monitor mode: %m");
goto finish;
}
r = sd_bus_negotiate_creds(bus, true, _SD_BUS_CREDS_ALL);
if (r < 0) {
- log_error_errno(-r, "Failed to enable credentials: %m");
+ log_error_errno(r, "Failed to enable credentials: %m");
goto finish;
}
r = sd_bus_negotiate_timestamp(bus, true);
if (r < 0) {
- log_error_errno(-r, "Failed to enable timestamps: %m");
+ log_error_errno(r, "Failed to enable timestamps: %m");
goto finish;
}
r = sd_bus_negotiate_fds(bus, true);
if (r < 0) {
- log_error_errno(-r, "Failed to enable fds: %m");
+ log_error_errno(r, "Failed to enable fds: %m");
goto finish;
}
}
@@ -1999,7 +1999,7 @@ int main(int argc, char *argv[]) {
else {
r = sd_bus_set_bus_client(bus, true);
if (r < 0) {
- log_error_errno(-r, "Failed to set bus client: %m");
+ log_error_errno(r, "Failed to set bus client: %m");
goto finish;
}
@@ -2025,13 +2025,13 @@ int main(int argc, char *argv[]) {
}
}
if (r < 0) {
- log_error_errno(-r, "Failed to set address: %m");
+ log_error_errno(r, "Failed to set address: %m");
goto finish;
}
r = sd_bus_start(bus);
if (r < 0) {
- log_error_errno(-r, "Failed to connect to bus: %m");
+ log_error_errno(r, "Failed to connect to bus: %m");
goto finish;
}
diff --git a/src/libsystemd/sd-bus/test-bus-chat.c b/src/libsystemd/sd-bus/test-bus-chat.c
index 7703878982..dfc54560af 100644
--- a/src/libsystemd/sd-bus/test-bus-chat.c
+++ b/src/libsystemd/sd-bus/test-bus-chat.c
@@ -54,7 +54,7 @@ static int object_callback(sd_bus *bus, sd_bus_message *m, void *userdata, sd_bu
r = sd_bus_reply_method_return(m, NULL);
if (r < 0) {
- log_error_errno(-r, "Failed to send reply: %m");
+ log_error_errno(r, "Failed to send reply: %m");
return r;
}
@@ -74,19 +74,19 @@ static int server_init(sd_bus **_bus) {
r = sd_bus_open_user(&bus);
if (r < 0) {
- log_error_errno(-r, "Failed to connect to user bus: %m");
+ log_error_errno(r, "Failed to connect to user bus: %m");
goto fail;
}
r = sd_bus_get_owner_id(bus, &id);
if (r < 0) {
- log_error_errno(-r, "Failed to get server ID: %m");
+ log_error_errno(r, "Failed to get server ID: %m");
goto fail;
}
r = sd_bus_get_unique_name(bus, &unique);
if (r < 0) {
- log_error_errno(-r, "Failed to get unique name: %m");
+ log_error_errno(r, "Failed to get unique name: %m");
goto fail;
}
@@ -96,25 +96,25 @@ static int server_init(sd_bus **_bus) {
r = sd_bus_request_name(bus, "org.freedesktop.systemd.test", 0);
if (r < 0) {
- log_error_errno(-r, "Failed to acquire name: %m");
+ log_error_errno(r, "Failed to acquire name: %m");
goto fail;
}
r = sd_bus_add_fallback(bus, NULL, "/foo/bar", object_callback, NULL);
if (r < 0) {
- log_error_errno(-r, "Failed to add object: %m");
+ log_error_errno(r, "Failed to add object: %m");
goto fail;
}
r = sd_bus_add_match(bus, NULL, "type='signal',interface='foo.bar',member='Notify'", match_callback, NULL);
if (r < 0) {
- log_error_errno(-r, "Failed to add match: %m");
+ log_error_errno(r, "Failed to add match: %m");
goto fail;
}
r = sd_bus_add_match(bus, NULL, "type='signal',interface='org.freedesktop.DBus',member='NameOwnerChanged'", match_callback, NULL);
if (r < 0) {
- log_error_errno(-r, "Failed to add match: %m");
+ log_error_errno(r, "Failed to add match: %m");
goto fail;
}
@@ -141,14 +141,14 @@ static int server(sd_bus *bus) {
r = sd_bus_process(bus, &m);
if (r < 0) {
- log_error_errno(-r, "Failed to process requests: %m");
+ log_error_errno(r, "Failed to process requests: %m");
goto fail;
}
if (r == 0) {
r = sd_bus_wait(bus, (uint64_t) -1);
if (r < 0) {
- log_error_errno(-r, "Failed to wait: %m");
+ log_error_errno(r, "Failed to wait: %m");
goto fail;
}
@@ -173,7 +173,7 @@ static int server(sd_bus *bus) {
r = sd_bus_message_read(m, "s", &hello);
if (r < 0) {
- log_error_errno(-r, "Failed to get parameter: %m");
+ log_error_errno(r, "Failed to get parameter: %m");
goto fail;
}
@@ -187,14 +187,14 @@ static int server(sd_bus *bus) {
r = sd_bus_reply_method_return(m, "s", lowercase);
if (r < 0) {
- log_error_errno(-r, "Failed to send reply: %m");
+ log_error_errno(r, "Failed to send reply: %m");
goto fail;
}
} else if (sd_bus_message_is_method_call(m, "org.freedesktop.systemd.test", "ExitClient1")) {
r = sd_bus_reply_method_return(m, NULL);
if (r < 0) {
- log_error_errno(-r, "Failed to send reply: %m");
+ log_error_errno(r, "Failed to send reply: %m");
goto fail;
}
@@ -203,7 +203,7 @@ static int server(sd_bus *bus) {
r = sd_bus_reply_method_return(m, NULL);
if (r < 0) {
- log_error_errno(-r, "Failed to send reply: %m");
+ log_error_errno(r, "Failed to send reply: %m");
goto fail;
}
@@ -214,7 +214,7 @@ static int server(sd_bus *bus) {
r = sd_bus_reply_method_return(m, NULL);
if (r < 0) {
- log_error_errno(-r, "Failed to send reply: %m");
+ log_error_errno(r, "Failed to send reply: %m");
goto fail;
}
@@ -224,7 +224,7 @@ static int server(sd_bus *bus) {
r = sd_bus_message_read(m, "h", &fd);
if (r < 0) {
- log_error_errno(-r, "Failed to get parameter: %m");
+ log_error_errno(r, "Failed to get parameter: %m");
goto fail;
}
@@ -238,7 +238,7 @@ static int server(sd_bus *bus) {
r = sd_bus_reply_method_return(m, NULL);
if (r < 0) {
- log_error_errno(-r, "Failed to send reply: %m");
+ log_error_errno(r, "Failed to send reply: %m");
goto fail;
}
@@ -248,7 +248,7 @@ static int server(sd_bus *bus) {
m,
&SD_BUS_ERROR_MAKE_CONST(SD_BUS_ERROR_UNKNOWN_METHOD, "Unknown method."));
if (r < 0) {
- log_error_errno(-r, "Failed to send reply: %m");
+ log_error_errno(r, "Failed to send reply: %m");
goto fail;
}
}
@@ -276,7 +276,7 @@ static void* client1(void*p) {
r = sd_bus_open_user(&bus);
if (r < 0) {
- log_error_errno(-r, "Failed to connect to user bus: %m");
+ log_error_errno(r, "Failed to connect to user bus: %m");
goto finish;
}
@@ -291,13 +291,13 @@ static void* client1(void*p) {
"s",
"HELLO");
if (r < 0) {
- log_error_errno(-r, "Failed to issue method call: %m");
+ log_error_errno(r, "Failed to issue method call: %m");
goto finish;
}
r = sd_bus_message_read(reply, "s", &hello);
if (r < 0) {
- log_error_errno(-r, "Failed to get string: %m");
+ log_error_errno(r, "Failed to get string: %m");
goto finish;
}
@@ -322,7 +322,7 @@ static void* client1(void*p) {
"h",
pp[1]);
if (r < 0) {
- log_error_errno(-r, "Failed to issue method call: %m");
+ log_error_errno(r, "Failed to issue method call: %m");
goto finish;
}
@@ -346,7 +346,7 @@ finish:
"org.freedesktop.systemd.test",
"ExitClient1");
if (r < 0)
- log_error_errno(-r, "Failed to allocate method call: %m");
+ log_error_errno(r, "Failed to allocate method call: %m");
else
sd_bus_send(bus, q, NULL);
@@ -380,7 +380,7 @@ static void* client2(void*p) {
r = sd_bus_open_user(&bus);
if (r < 0) {
- log_error_errno(-r, "Failed to connect to user bus: %m");
+ log_error_errno(r, "Failed to connect to user bus: %m");
goto finish;
}
@@ -392,7 +392,7 @@ static void* client2(void*p) {
"org.object.test",
"Foobar");
if (r < 0) {
- log_error_errno(-r, "Failed to allocate method call: %m");
+ log_error_errno(r, "Failed to allocate method call: %m");
goto finish;
}
@@ -412,7 +412,7 @@ static void* client2(void*p) {
"foo.bar",
"Notify");
if (r < 0) {
- log_error_errno(-r, "Failed to allocate signal: %m");
+ log_error_errno(r, "Failed to allocate signal: %m");
goto finish;
}
@@ -433,7 +433,7 @@ static void* client2(void*p) {
"org.freedesktop.DBus.Peer",
"GetMachineId");
if (r < 0) {
- log_error_errno(-r, "Failed to allocate method call: %m");
+ log_error_errno(r, "Failed to allocate method call: %m");
goto finish;
}
@@ -445,7 +445,7 @@ static void* client2(void*p) {
r = sd_bus_message_read(reply, "s", &mid);
if (r < 0) {
- log_error_errno(-r, "Failed to parse machine ID: %m");
+ log_error_errno(r, "Failed to parse machine ID: %m");
goto finish;
}
@@ -462,7 +462,7 @@ static void* client2(void*p) {
"org.freedesktop.systemd.test",
"Slow");
if (r < 0) {
- log_error_errno(-r, "Failed to allocate method call: %m");
+ log_error_errno(r, "Failed to allocate method call: %m");
goto finish;
}
@@ -486,7 +486,7 @@ static void* client2(void*p) {
"org.freedesktop.systemd.test",
"Slow");
if (r < 0) {
- log_error_errno(-r, "Failed to allocate method call: %m");
+ log_error_errno(r, "Failed to allocate method call: %m");
goto finish;
}
@@ -499,13 +499,13 @@ static void* client2(void*p) {
while (!quit) {
r = sd_bus_process(bus, NULL);
if (r < 0) {
- log_error_errno(-r, "Failed to process requests: %m");
+ log_error_errno(r, "Failed to process requests: %m");
goto finish;
}
if (r == 0) {
r = sd_bus_wait(bus, (uint64_t) -1);
if (r < 0) {
- log_error_errno(-r, "Failed to wait: %m");
+ log_error_errno(r, "Failed to wait: %m");
goto finish;
}
}
@@ -525,7 +525,7 @@ finish:
"org.freedesktop.systemd.test",
"ExitClient2");
if (r < 0) {
- log_error_errno(-r, "Failed to allocate method call: %m");
+ log_error_errno(r, "Failed to allocate method call: %m");
goto finish;
}
diff --git a/src/libsystemd/sd-bus/test-bus-objects.c b/src/libsystemd/sd-bus/test-bus-objects.c
index 2ed34e5120..06b8904f13 100644
--- a/src/libsystemd/sd-bus/test-bus-objects.c
+++ b/src/libsystemd/sd-bus/test-bus-objects.c
@@ -237,14 +237,14 @@ static void *server(void *p) {
r = sd_bus_process(bus, NULL);
if (r < 0) {
- log_error_errno(-r, "Failed to process requests: %m");
+ log_error_errno(r, "Failed to process requests: %m");
goto fail;
}
if (r == 0) {
r = sd_bus_wait(bus, (uint64_t) -1);
if (r < 0) {
- log_error_errno(-r, "Failed to wait: %m");
+ log_error_errno(r, "Failed to wait: %m");
goto fail;
}
diff --git a/src/libsystemd/sd-bus/test-bus-server.c b/src/libsystemd/sd-bus/test-bus-server.c
index 30e2d8cf44..e65811f047 100644
--- a/src/libsystemd/sd-bus/test-bus-server.c
+++ b/src/libsystemd/sd-bus/test-bus-server.c
@@ -65,14 +65,14 @@ static void *server(void *p) {
r = sd_bus_process(bus, &m);
if (r < 0) {
- log_error_errno(-r, "Failed to process requests: %m");
+ log_error_errno(r, "Failed to process requests: %m");
goto fail;
}
if (r == 0) {
r = sd_bus_wait(bus, (uint64_t) -1);
if (r < 0) {
- log_error_errno(-r, "Failed to wait: %m");
+ log_error_errno(r, "Failed to wait: %m");
goto fail;
}
@@ -90,7 +90,7 @@ static void *server(void *p) {
r = sd_bus_message_new_method_return(m, &reply);
if (r < 0) {
- log_error_errno(-r, "Failed to allocate return: %m");
+ log_error_errno(r, "Failed to allocate return: %m");
goto fail;
}
@@ -102,7 +102,7 @@ static void *server(void *p) {
&reply,
&SD_BUS_ERROR_MAKE_CONST(SD_BUS_ERROR_UNKNOWN_METHOD, "Unknown method."));
if (r < 0) {
- log_error_errno(-r, "Failed to allocate return: %m");
+ log_error_errno(r, "Failed to allocate return: %m");
goto fail;
}
}
@@ -110,7 +110,7 @@ static void *server(void *p) {
if (reply) {
r = sd_bus_send(bus, reply, NULL);
if (r < 0) {
- log_error_errno(-r, "Failed to send reply: %m");
+ log_error_errno(r, "Failed to send reply: %m");
goto fail;
}
}
@@ -147,7 +147,7 @@ static int client(struct context *c) {
"org.freedesktop.systemd.test",
"Exit");
if (r < 0) {
- log_error_errno(-r, "Failed to allocate method call: %m");
+ log_error_errno(r, "Failed to allocate method call: %m");
return r;
}