chiark / gitweb /
nspawn: when connected to pipes for stdin/stdout, pass them as-is to PID 1
[elogind.git] / src / run / run.c
index b183e4e616ac3ff07f90e619846938dcfdcd8965..3ded2c7e66ebd9a4cc427dcf9e53fa4e71303289 100644 (file)
@@ -86,11 +86,11 @@ static void help(void) {
                "  -t --pty                        Run service on pseudo tty\n"
                "  -q --quiet                      Suppress information messages during runtime\n\n"
                "Timer options:\n\n"
-               "     --on-active=SEC              Run after seconds\n"
-               "     --on-boot=SEC                Run after seconds from machine was booted up\n"
-               "     --on-startup=SEC             Run after seconds from systemd was first started\n"
-               "     --on-unit-active=SEC         Run after seconds from the last activation\n"
-               "     --on-unit-inactive=SEC       Run after seconds from the last deactivation\n"
+               "     --on-active=SECONDS          Run after SECONDS delay\n"
+               "     --on-boot=SECONDS            Run SECONDS after machine was booted up\n"
+               "     --on-startup=SECONDS         Run SECONDS after systemd activation\n"
+               "     --on-unit-active=SECONDS     Run SECONDS after the last activation\n"
+               "     --on-unit-inactive=SECONDS   Run SECONDS after the last deactivation\n"
                "     --on-calendar=SPEC           Realtime timer\n"
                "     --timer-property=NAME=VALUE  Set timer unit property\n",
                program_invocation_short_name);
@@ -241,14 +241,12 @@ static int parse_argv(int argc, char *argv[]) {
                         break;
 
                 case ARG_SETENV:
-
                         if (strv_extend(&arg_environment, optarg) < 0)
                                 return log_oom();
 
                         break;
 
                 case 'p':
-
                         if (strv_extend(&arg_property, optarg) < 0)
                                 return log_oom();
 
@@ -389,11 +387,8 @@ static int transient_unit_set_properties(sd_bus_message *m, char **properties) {
                         return r;
 
                 r = bus_append_unit_property_assignment(m, *i);
-                if (r < 0) {
-                        r = sd_bus_message_append(m, "sv", 0);
-                        if (r < 0)
-                                return r;
-                }
+                if (r < 0)
+                        return r;
 
                 r = sd_bus_message_close_container(m);
                 if (r < 0)
@@ -423,16 +418,12 @@ static int transient_cgroup_set_properties(sd_bus_message *m) {
 }
 
 static int transient_kill_set_properties(sd_bus_message *m) {
-        int r;
         assert(m);
 
-        if (arg_send_sighup) {
-                r = sd_bus_message_append(m, "(sv)", "SendSIGHUP", "b", arg_send_sighup);
-                if (r < 0)
-                        return r;
-        }
-
-        return r;
+        if (arg_send_sighup)
+                return sd_bus_message_append(m, "(sv)", "SendSIGHUP", "b", arg_send_sighup);
+        else
+                return 0;
 }
 
 static int transient_service_set_properties(sd_bus_message *m, char **argv, const char *pty_path) {
@@ -498,7 +489,7 @@ static int transient_service_set_properties(sd_bus_message *m, char **argv, cons
                 if (e) {
                         char *n;
 
-                        n = strappenda("TERM=", e);
+                        n = strjoina("TERM=", e);
                         r = sd_bus_message_append(m,
                                                   "(sv)",
                                                   "Environment", "as", 1, n);
@@ -785,7 +776,7 @@ static int start_transient_service(
                 if (!arg_quiet)
                         log_info("Running as unit %s.\nPress ^] three times within 1s to disconnect TTY.", service);
 
-                r = pty_forward_new(event, master, false, &forward);
+                r = pty_forward_new(event, master, false, false, &forward);
                 if (r < 0)
                         return log_error_errno(r, "Failed to create PTY forwarder: %m");
 
@@ -793,7 +784,7 @@ static int start_transient_service(
                 if (r < 0)
                         return log_error_errno(r, "Failed to run event loop: %m");
 
-                pty_forward_last_char(forward, &last_char);
+                pty_forward_get_last_char(forward, &last_char);
 
                 forward = pty_forward_free(forward);