chiark / gitweb /
terminal: sd_bus_error_get_errno returns positive errno
authorThomas Hindoe Paaboel Andersen <phomes@gmail.com>
Mon, 15 Sep 2014 20:55:36 +0000 (22:55 +0200)
committerThomas Hindoe Paaboel Andersen <phomes@gmail.com>
Tue, 16 Sep 2014 19:31:15 +0000 (21:31 +0200)
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

index 2083f5a..fde87d1 100644 (file)
@@ -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)");