chiark / gitweb /
login: fix pos-array allocation
[elogind.git] / src / login / inhibit.c
index e20af74ef0949d873b9f44b93ec6e4aa0021d61a..48c2ec401ffdfbdfebb6533ea3d2b7545030b20e 100644 (file)
@@ -92,7 +92,7 @@ static int print_inhibitors(sd_bus *bus, sd_bus_error *error) {
 
         r = sd_bus_message_enter_container(reply, SD_BUS_TYPE_ARRAY, "(ssssuu)");
         if (r < 0)
 
         r = sd_bus_message_enter_container(reply, SD_BUS_TYPE_ARRAY, "(ssssuu)");
         if (r < 0)
-                return -EIO;
+                return bus_log_parse_error(r);
 
         while ((r = sd_bus_message_read(reply, "(ssssuu)", &what, &who, &why, &mode, &uid, &pid)) > 0) {
                 _cleanup_free_ char *comm = NULL, *u = NULL;
 
         while ((r = sd_bus_message_read(reply, "(ssssuu)", &what, &who, &why, &mode, &uid, &pid)) > 0) {
                 _cleanup_free_ char *comm = NULL, *u = NULL;
@@ -112,11 +112,11 @@ static int print_inhibitors(sd_bus *bus, sd_bus_error *error) {
                 n++;
         }
         if (r < 0)
                 n++;
         }
         if (r < 0)
-                return -EIO;
+                return bus_log_parse_error(r);
 
         r = sd_bus_message_exit_container(reply);
         if (r < 0)
 
         r = sd_bus_message_exit_container(reply);
         if (r < 0)
-                return -EIO;
+                return bus_log_parse_error(r);
 
         printf("%u inhibitors listed.\n", n);
         return 0;
 
         printf("%u inhibitors listed.\n", n);
         return 0;
@@ -233,7 +233,7 @@ int main(int argc, char *argv[]) {
         if (r == 0)
                 return EXIT_SUCCESS;
 
         if (r == 0)
                 return EXIT_SUCCESS;
 
-        r = sd_bus_open_system(&bus);
+        r = sd_bus_default_system(&bus);
         if (r < 0) {
                 log_error("Failed to connect to bus: %s", strerror(-r));
                 return EXIT_FAILURE;
         if (r < 0) {
                 log_error("Failed to connect to bus: %s", strerror(-r));
                 return EXIT_FAILURE;