summaryrefslogtreecommitdiff
path: root/src/login/loginctl.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/login/loginctl.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/login/loginctl.c')
-rw-r--r--src/login/loginctl.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/login/loginctl.c b/src/login/loginctl.c
index fcdf6275e..d0fd14b90 100644
--- a/src/login/loginctl.c
+++ b/src/login/loginctl.c
@@ -385,7 +385,7 @@ static int print_session_status_info(sd_bus *bus, const char *path, bool *new_li
r = bus_map_all_properties(bus, "org.freedesktop.login1", path, map, &i);
if (r < 0) {
- log_error("Could not get properties: %s", strerror(-r));
+ log_error_errno(-r, "Could not get properties: %m");
return r;
}
@@ -498,7 +498,7 @@ static int print_user_status_info(sd_bus *bus, const char *path, bool *new_line)
r = bus_map_all_properties(bus, "org.freedesktop.login1", path, map, &i);
if (r < 0) {
- log_error("Could not get properties: %s", strerror(-r));
+ log_error_errno(-r, "Could not get properties: %m");
goto finish;
}
@@ -562,7 +562,7 @@ static int print_seat_status_info(sd_bus *bus, const char *path, bool *new_line)
r = bus_map_all_properties(bus, "org.freedesktop.login1", path, map, &i);
if (r < 0) {
- log_error("Could not get properties: %s", strerror(-r));
+ log_error_errno(-r, "Could not get properties: %m");
goto finish;
}
@@ -617,7 +617,7 @@ static int show_properties(sd_bus *bus, const char *path, bool *new_line) {
r = bus_print_all_properties(bus, "org.freedesktop.login1", path, arg_property, arg_all);
if (r < 0)
- log_error("Could not get properties: %s", strerror(-r));
+ log_error_errno(-r, "Could not get properties: %m");
return r;
}
@@ -700,7 +700,7 @@ static int show_user(sd_bus *bus, char **args, unsigned n) {
r = get_user_creds((const char**) (args+i), &uid, NULL, NULL, NULL);
if (r < 0) {
- log_error("Failed to look up user %s: %s", args[i], strerror(-r));
+ log_error_errno(-r, "Failed to look up user %s: %m", args[i]);
return r;
}
@@ -860,7 +860,7 @@ static int enable_linger(sd_bus *bus, char **args, unsigned n) {
r = get_user_creds((const char**) (args+i), &uid, NULL, NULL, NULL);
if (r < 0) {
- log_error("Failed to look up user %s: %s", args[i], strerror(-r));
+ log_error_errno(-r, "Failed to look up user %s: %m", args[i]);
return r;
}
@@ -893,7 +893,7 @@ static int terminate_user(sd_bus *bus, char **args, unsigned n) {
r = get_user_creds((const char**) (args+i), &uid, NULL, NULL, NULL);
if (r < 0) {
- log_error("Failed to look up user %s: %s", args[i], strerror(-r));
+ log_error_errno(-r, "Failed to look up user %s: %m", args[i]);
return r;
}
@@ -929,7 +929,7 @@ static int kill_user(sd_bus *bus, char **args, unsigned n) {
r = get_user_creds((const char**) (args+i), &uid, NULL, NULL, NULL);
if (r < 0) {
- log_error("Failed to look up user %s: %s", args[i], strerror(-r));
+ log_error_errno(-r, "Failed to look up user %s: %m", args[i]);
return r;
}
@@ -1308,7 +1308,7 @@ int main(int argc, char *argv[]) {
r = bus_open_transport(arg_transport, arg_host, false, &bus);
if (r < 0) {
- log_error("Failed to create bus connection: %s", strerror(-r));
+ log_error_errno(-r, "Failed to create bus connection: %m");
goto finish;
}