summaryrefslogtreecommitdiff
path: root/src/libsystemd/sd-bus/busctl.c
diff options
context:
space:
mode:
authorMichal Schmidt <mschmidt@redhat.com>2014-11-28 11:58:34 +0100
committerMichal Schmidt <mschmidt@redhat.com>2014-11-28 12:04:41 +0100
commit0a1beeb64207eaa88ab9236787b1cbc2f704ae14 (patch)
tree50117277be2e2078d0373b944a30b4f09bb94443 /src/libsystemd/sd-bus/busctl.c
parentb4d23205f238e06aaa31264628e20669e714acad (diff)
treewide: auto-convert the simple cases to log_*_errno()
As a followup to 086891e5c1 "log: add an "error" parameter to all low-level logging calls and intrdouce log_error_errno() as log calls that take error numbers", use sed to convert the simple cases to use the new macros: find . -name '*.[ch]' | xargs sed -r -i -e \ 's/log_(debug|info|notice|warning|error|emergency)\("(.*)%s"(.*), strerror\(-([a-zA-Z_]+)\)\);/log_\1_errno(-\4, "\2%m"\3);/' Multi-line log_*() invocations are not covered. And we also should add log_unit_*_errno().
Diffstat (limited to 'src/libsystemd/sd-bus/busctl.c')
-rw-r--r--src/libsystemd/sd-bus/busctl.c36
1 files changed, 18 insertions, 18 deletions
diff --git a/src/libsystemd/sd-bus/busctl.c b/src/libsystemd/sd-bus/busctl.c
index e432db406b..8cc309c01b 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("Failed to list names: %s", strerror(-r));
+ 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("Failed to add to hashmap: %s", strerror(-r));
+ 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("Failed to add to hashmap: %s", strerror(-r));
+ 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("Failed to get name list: %s", strerror(-r));
+ 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("Failed to add match: %s", strerror(-r));
+ 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("Failed to add match: %s", strerror(-r));
+ 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("Failed to add match: %s", strerror(-r));
+ 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("Failed to process bus: %s", strerror(-r));
+ 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("Failed to wait for bus: %s", strerror(-r));
+ 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("Failed to get credentials: %s", strerror(-r));
+ 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("Failed to allocate bus: %s", strerror(-r));
+ 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("Failed to set monitor mode: %s", strerror(-r));
+ 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("Failed to enable credentials: %s", strerror(-r));
+ log_error_errno(-r, "Failed to enable credentials: %m");
goto finish;
}
r = sd_bus_negotiate_timestamp(bus, true);
if (r < 0) {
- log_error("Failed to enable timestamps: %s", strerror(-r));
+ log_error_errno(-r, "Failed to enable timestamps: %m");
goto finish;
}
r = sd_bus_negotiate_fds(bus, true);
if (r < 0) {
- log_error("Failed to enable fds: %s", strerror(-r));
+ 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("Failed to set bus client: %s", strerror(-r));
+ 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("Failed to set address: %s", strerror(-r));
+ log_error_errno(-r, "Failed to set address: %m");
goto finish;
}
r = sd_bus_start(bus);
if (r < 0) {
- log_error("Failed to connect to bus: %s", strerror(-r));
+ log_error_errno(-r, "Failed to connect to bus: %m");
goto finish;
}