chiark / gitweb /
bus: log message parsing errors everywhere with a generalized bus_log_parse_error()
[elogind.git] / src / nspawn / nspawn.c
index 9f887134c13f7506d4397a55977235ebd457d8dd..06d627c0a9ce1840c938af070385073a292c7080 100644 (file)
@@ -165,7 +165,7 @@ static int parse_argv(int argc, char *argv[]) {
                 { "bind-ro",         required_argument, NULL, ARG_BIND_RO         },
                 { "machine",         required_argument, NULL, 'M'                 },
                 { "slice",           required_argument, NULL, 'S'                 },
-                { NULL,              0,                 NULL, 0                   }
+                {}
         };
 
         int c, r;
@@ -178,8 +178,7 @@ static int parse_argv(int argc, char *argv[]) {
                 switch (c) {
 
                 case 'h':
-                        help();
-                        return 0;
+                        return help();
 
                 case ARG_VERSION:
                         puts(PACKAGE_STRING);
@@ -329,8 +328,7 @@ static int parse_argv(int argc, char *argv[]) {
                         return -EINVAL;
 
                 default:
-                        log_error("Unknown option code %c", c);
-                        return -EINVAL;
+                        assert_not_reached("Unhandled option");
                 }
         }
 
@@ -992,10 +990,8 @@ static int terminate_machine(pid_t pid) {
         }
 
         r = sd_bus_message_read(reply, "o", &path);
-        if (r < 0) {
-                log_error("Failed to parse GetMachineByPID() reply: %s", bus_error_message(&error, r));
-                return r;
-        }
+        if (r < 0)
+                return bus_log_parse_error(r);
 
         r = sd_bus_call_method(
                         bus,