[systemd-devel] [PATCH 2/2] terminal: sd_bus_error_get_errno returns positive errno

Thomas H.P. Andersen phomes at gmail.com
Mon Sep 15 14:15:33 PDT 2014


From: Thomas Hindoe Paaboel Andersen <phomes at gmail.com>

The 3 calls to sd_bus_error_get_errno appear to expect a negative
return value.

This patch negates the returned value so it matches the other error
cases in the 3 functions where sd_bus_error_get_errno is used.
---
 src/libsystemd-terminal/sysview.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/libsystemd-terminal/sysview.c b/src/libsystemd-terminal/sysview.c
index 2083f5a..fde87d1 100644
--- a/src/libsystemd-terminal/sysview.c
+++ b/src/libsystemd-terminal/sysview.c
@@ -263,7 +263,7 @@ static int session_take_control_fn(sd_bus *bus,
 
                 log_debug("sysview: %s: TakeControl failed: %s: %s",
                           session->name, e->name, e->message);
-                error = sd_bus_error_get_errno(e);
+                error = -sd_bus_error_get_errno(e);
         } else {
                 session->has_control = true;
                 error = 0;
@@ -1195,7 +1195,7 @@ static int context_ld_list_seats_fn(sd_bus *bus,
 
                 log_debug("sysview: ListSeats on logind failed: %s: %s",
                           error->name, error->message);
-                return sd_bus_error_get_errno(error);
+                return -sd_bus_error_get_errno(error);
         }
 
         r = sd_bus_message_enter_container(reply, 'a', "(so)");
@@ -1247,7 +1247,7 @@ static int context_ld_list_sessions_fn(sd_bus *bus,
 
                 log_debug("sysview: ListSessions on logind failed: %s: %s",
                           error->name, error->message);
-                return sd_bus_error_get_errno(error);
+                return -sd_bus_error_get_errno(error);
         }
 
         r = sd_bus_message_enter_container(reply, 'a', "(susso)");
-- 
2.1.0



More information about the systemd-devel mailing list