From c60c93c0684b307e641bf17a9970b3d558c41cea Mon Sep 17 00:00:00 2001 From: Davin McCall Date: Sat, 10 Feb 2018 14:42:03 +0000 Subject: [PATCH] Make sure a process service starts-on-console matches runs-on-console. --- TODO | 3 --- src/load-service.cc | 3 +++ 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/TODO b/TODO index 8356d7e..72220a4 100644 --- a/TODO +++ b/TODO @@ -1,5 +1,3 @@ -* Prevent PROCESS services from being starts-on-console without also being runs-on-console. - * shutdown command presently hangs if terminal output blocked (scroll lock via ^S). Should use a buffer as dinit does, and pipe output from subcommands via the buffer too - if the buffer becomes full, discard subcommand output @@ -15,7 +13,6 @@ For version 1.0: ---------------- * Man pages for all programs (done for dinit, not for dinitctl/shutdown/etc). * Write wtmp entry on startup (see simpleinit) -* Allow running services as a different UID * "triggered" service type: external process notifies Dinit when the service has started. * Ability to reload stopped services (reload service description) diff --git a/src/load-service.cc b/src/load-service.cc index ba2bfe4..b6d72f5 100644 --- a/src/load-service.cc +++ b/src/load-service.cc @@ -622,6 +622,8 @@ service_record * dirload_service_set::load_service(const char * name) rvalps->set_start_interruptible(start_is_interruptible); rvalps->set_extra_termination_signal(term_signal); rvalps->set_run_as_uid_gid(run_as_uid, run_as_gid); + // process service start / run on console must be the same: + onstart_flags.starts_on_console = onstart_flags.runs_on_console; rval = rvalps; } else if (service_type == service_type_t::BGPROCESS) { @@ -635,6 +637,7 @@ service_record * dirload_service_set::load_service(const char * name) rvalps->set_start_interruptible(start_is_interruptible); rvalps->set_extra_termination_signal(term_signal); rvalps->set_run_as_uid_gid(run_as_uid, run_as_gid); + onstart_flags.runs_on_console = false; rval = rvalps; } else if (service_type == service_type_t::SCRIPTED) { -- 2.25.1