init: sometimes, #ifdefs are cleaner.

This commit is contained in:
Denis Vlasenko 2007-12-25 16:08:53 +00:00
parent 1d61416b5a
commit 5adfa44101

View File

@ -326,14 +326,9 @@ static pid_t run(const struct init_action *a)
open_stdio_to_tty(a->terminal, 1 /* - exit if open fails*/); open_stdio_to_tty(a->terminal, 1 /* - exit if open fails*/);
#ifdef BUT_RUN_ACTIONS_ALREADY_DOES_WAITING #ifdef BUT_RUN_ACTIONS_ALREADY_DOES_WAITING
# define BRAADS 1
#else
# define BRAADS 0
#endif
/* If the init Action requires us to wait, then force the /* If the init Action requires us to wait, then force the
* supplied terminal to be the controlling tty. */ * supplied terminal to be the controlling tty. */
if (BRAADS && a->action & (SYSINIT | WAIT | CTRLALTDEL | SHUTDOWN | RESTART)) { if (a->action & (SYSINIT | WAIT | CTRLALTDEL | SHUTDOWN | RESTART)) {
/* Now fork off another process to just hang around */ /* Now fork off another process to just hang around */
pid = fork(); pid = fork();
if (pid < 0) { if (pid < 0) {
@ -370,6 +365,7 @@ static pid_t run(const struct init_action *a)
/* Child - fall though to actually execute things */ /* Child - fall though to actually execute things */
} }
#endif
/* See if any special /bin/sh requiring characters are present */ /* See if any special /bin/sh requiring characters are present */
if (strpbrk(a->command, "~`!$^&*()=|\\{}[];\"'<>?") != NULL) { if (strpbrk(a->command, "~`!$^&*()=|\\{}[];\"'<>?") != NULL) {
@ -403,11 +399,6 @@ static pid_t run(const struct init_action *a)
++cmdpath; ++cmdpath;
#ifdef WHY_WE_DO_THIS_SHELL_MUST_HANDLE_THIS_ITSELF #ifdef WHY_WE_DO_THIS_SHELL_MUST_HANDLE_THIS_ITSELF
# define WWDTSMHTI 1
#else
# define WWDTSMHTI 0
#endif
if (WWDTSMHTI) {
/* find the last component in the command pathname */ /* find the last component in the command pathname */
s = bb_get_last_path_component_nostrip(cmdpath); s = bb_get_last_path_component_nostrip(cmdpath);
/* make a new argv[0] */ /* make a new argv[0] */
@ -419,7 +410,7 @@ static pid_t run(const struct init_action *a)
cmd[0][0] = '-'; cmd[0][0] = '-';
strcpy(cmd[0] + 1, s); strcpy(cmd[0] + 1, s);
} }
} #endif
/* Establish this process as session leader and /* Establish this process as session leader and
* _attempt_ to make stdin a controlling tty. * _attempt_ to make stdin a controlling tty.