From c07b384d82f78959adc96fbbbef72cae5bf3c272 Mon Sep 17 00:00:00 2001 From: Roy Marples Date: Fri, 24 Apr 2009 11:49:55 +0000 Subject: Don't drop to sulogin by default, but make this configurable. --- src/rc/rc.c | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) (limited to 'src/rc/rc.c') diff --git a/src/rc/rc.c b/src/rc/rc.c index 83a3701..56d6d58 100644 --- a/src/rc/rc.c +++ b/src/rc/rc.c @@ -299,7 +299,7 @@ run_program(const char *prog) if (termios_orig) tcsetattr(STDIN_FILENO, TCSANOW, termios_orig); - execl(prog, prog, (char *) NULL); + execl(prog, prog, (char *)NULL); eerror("%s: unable to exec `%s': %s", applet, prog, strerror(errno)); _exit(EXIT_FAILURE); @@ -312,12 +312,14 @@ run_program(const char *prog) } static void -sulogin(bool cont) +open_shell(void) { + const char *shell; + #ifdef __linux__ const char *sys = rc_sys(); - /* VSERVER and OPENVZ systems cannot do a sulogin */ + /* VSERVER and OPENVZ systems cannot really drop to shells */ if (sys && (strcmp(sys, "VSERVER") == 0 || strcmp(sys, "OPENVZ") == 0)) { @@ -326,15 +328,11 @@ sulogin(bool cont) applet, strerror(errno)); } #endif - if (!cont) { - rc_logger_close(); - exit(EXIT_SUCCESS); - } -#ifdef __linux__ - run_program(SULOGIN); -#else - run_program("/bin/sh"); -#endif + + shell = rc_conf_value("rc_shell"); + if (shell == NULL) + shell = "/bin/sh"; + run_program(shell); } _dead static void @@ -695,7 +693,7 @@ do_start_services(bool parallel) case '1': break; case '2': continue; case '3': interactive = false; break; - case '4': sulogin(true); goto interactive_retry; + case '4': open_shell(); goto interactive_retry; default: goto interactive_option; } } -- cgit v1.2.3