aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2005-07-06 05:00:48 +0000
committerMike Frysinger <vapier@gentoo.org>2005-07-06 05:00:48 +0000
commit10427ab5282582f407fab329638c187ae6b0c244 (patch)
treec0368fffae8ae7318a2be05b729899c5f94d456a
parente548bdff969aeaeac084c351dc375d37e918f634 (diff)
downloadbusybox-w32-10427ab5282582f407fab329638c187ae6b0c244.tar.gz
busybox-w32-10427ab5282582f407fab329638c187ae6b0c244.tar.bz2
busybox-w32-10427ab5282582f407fab329638c187ae6b0c244.zip
move var decls around a little to help gcc make smaller code
-rw-r--r--init/init.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/init/init.c b/init/init.c
index 95d7253ea..8687b106c 100644
--- a/init/init.c
+++ b/init/init.c
@@ -424,9 +424,8 @@ static void fixup_argv(int argc, char **argv, char *new_argv0)
424 424
425static pid_t run(const struct init_action *a) 425static pid_t run(const struct init_action *a)
426{ 426{
427 struct stat sb;
428 int i, junk; 427 int i, junk;
429 pid_t pid, pgrp, tmp_pid; 428 pid_t pid;
430 char *s, *tmpCmd, *cmd[INIT_BUFFS_SIZE], *cmdpath; 429 char *s, *tmpCmd, *cmd[INIT_BUFFS_SIZE], *cmdpath;
431 char buf[INIT_BUFFS_SIZE + 6]; /* INIT_BUFFS_SIZE+strlen("exec ")+1 */ 430 char buf[INIT_BUFFS_SIZE + 6]; /* INIT_BUFFS_SIZE+strlen("exec ")+1 */
432 sigset_t nmask, omask; 431 sigset_t nmask, omask;
@@ -442,6 +441,8 @@ static pid_t run(const struct init_action *a)
442 sigprocmask(SIG_BLOCK, &nmask, &omask); 441 sigprocmask(SIG_BLOCK, &nmask, &omask);
443 442
444 if ((pid = fork()) == 0) { 443 if ((pid = fork()) == 0) {
444 struct stat sb;
445
445 /* Clean up */ 446 /* Clean up */
446 close(0); 447 close(0);
447 close(1); 448 close(1);
@@ -466,11 +467,10 @@ static pid_t run(const struct init_action *a)
466 /* Open the new terminal device */ 467 /* Open the new terminal device */
467 if ((device_open(a->terminal, O_RDWR)) < 0) { 468 if ((device_open(a->terminal, O_RDWR)) < 0) {
468 if (stat(a->terminal, &sb) != 0) { 469 if (stat(a->terminal, &sb) != 0) {
469 message(LOG | CONSOLE, "device '%s' does not exist.", 470 message(LOG | CONSOLE, "device '%s' does not exist.", a->terminal);
470 a->terminal); 471 } else {
471 _exit(1); 472 message(LOG | CONSOLE, "Bummer, can't open %s", a->terminal);
472 } 473 }
473 message(LOG | CONSOLE, "Bummer, can't open %s", a->terminal);
474 _exit(1); 474 _exit(1);
475 } 475 }
476 476
@@ -484,6 +484,7 @@ static pid_t run(const struct init_action *a)
484 /* If the init Action requires us to wait, then force the 484 /* If the init Action requires us to wait, then force the
485 * supplied terminal to be the controlling tty. */ 485 * supplied terminal to be the controlling tty. */
486 if (a->action & (SYSINIT | WAIT | CTRLALTDEL | SHUTDOWN | RESTART)) { 486 if (a->action & (SYSINIT | WAIT | CTRLALTDEL | SHUTDOWN | RESTART)) {
487 pid_t pgrp, tmp_pid;
487 488
488 /* Now fork off another process to just hang around */ 489 /* Now fork off another process to just hang around */
489 if ((pid = fork()) < 0) { 490 if ((pid = fork()) < 0) {
@@ -733,8 +734,6 @@ static void exec_signal(int sig)
733 for (a = init_action_list; a; a = tmp) { 734 for (a = init_action_list; a; a = tmp) {
734 tmp = a->next; 735 tmp = a->next;
735 if (a->action & RESTART) { 736 if (a->action & RESTART) {
736 struct stat sb;
737
738 shutdown_system(); 737 shutdown_system();
739 738
740 /* unblock all signals, blocked in shutdown_system() */ 739 /* unblock all signals, blocked in shutdown_system() */
@@ -758,6 +757,7 @@ static void exec_signal(int sig)
758 757
759 /* Open the new terminal device */ 758 /* Open the new terminal device */
760 if ((device_open(a->terminal, O_RDWR)) < 0) { 759 if ((device_open(a->terminal, O_RDWR)) < 0) {
760 struct stat sb;
761 if (stat(a->terminal, &sb) != 0) { 761 if (stat(a->terminal, &sb) != 0) {
762 message(LOG | CONSOLE, "device '%s' does not exist.", a->terminal); 762 message(LOG | CONSOLE, "device '%s' does not exist.", a->terminal);
763 } else { 763 } else {