diff options
author | Eric Andersen <andersen@codepoet.org> | 2001-06-26 23:00:21 +0000 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 2001-06-26 23:00:21 +0000 |
commit | a90f20b1c330bef928e99031e710836024fcaf5f (patch) | |
tree | a2ba0790f64c246b8e95d6204b90124ce7d1e5f1 | |
parent | d98337a7b49f389973a3138230f55e27d754e926 (diff) | |
download | busybox-w32-a90f20b1c330bef928e99031e710836024fcaf5f.tar.gz busybox-w32-a90f20b1c330bef928e99031e710836024fcaf5f.tar.bz2 busybox-w32-a90f20b1c330bef928e99031e710836024fcaf5f.zip |
Don't choke if /etc/profile is not available
-rw-r--r-- | hush.c | 15 | ||||
-rw-r--r-- | shell/hush.c | 15 |
2 files changed, 14 insertions, 16 deletions
@@ -2556,9 +2556,7 @@ static void setup_job_control() | |||
2556 | 2556 | ||
2557 | /* Put ourselves in our own process group. */ | 2557 | /* Put ourselves in our own process group. */ |
2558 | shell_pgrp = getpid (); | 2558 | shell_pgrp = getpid (); |
2559 | if (setpgid (shell_pgrp, shell_pgrp) < 0) { | 2559 | setpgid (shell_pgrp, shell_pgrp); |
2560 | perror_msg_and_die("Couldn't put the shell in its own process group"); | ||
2561 | } | ||
2562 | 2560 | ||
2563 | /* Grab control of the terminal. */ | 2561 | /* Grab control of the terminal. */ |
2564 | tcsetpgrp(shell_terminal, shell_pgrp); | 2562 | tcsetpgrp(shell_terminal, shell_pgrp); |
@@ -2607,11 +2605,12 @@ int shell_main(int argc, char **argv) | |||
2607 | 2605 | ||
2608 | if (argv[0] && argv[0][0] == '-') { | 2606 | if (argv[0] && argv[0][0] == '-') { |
2609 | debug_printf("\nsourcing /etc/profile\n"); | 2607 | debug_printf("\nsourcing /etc/profile\n"); |
2610 | input = xfopen("/etc/profile", "r"); | 2608 | if ((input = fopen("/etc/profile", "r")) != NULL) { |
2611 | mark_open(fileno(input)); | 2609 | mark_open(fileno(input)); |
2612 | parse_file_outer(input); | 2610 | parse_file_outer(input); |
2613 | mark_closed(fileno(input)); | 2611 | mark_closed(fileno(input)); |
2614 | fclose(input); | 2612 | fclose(input); |
2613 | } | ||
2615 | } | 2614 | } |
2616 | input=stdin; | 2615 | input=stdin; |
2617 | 2616 | ||
diff --git a/shell/hush.c b/shell/hush.c index 859353dcf..f70074f14 100644 --- a/shell/hush.c +++ b/shell/hush.c | |||
@@ -2556,9 +2556,7 @@ static void setup_job_control() | |||
2556 | 2556 | ||
2557 | /* Put ourselves in our own process group. */ | 2557 | /* Put ourselves in our own process group. */ |
2558 | shell_pgrp = getpid (); | 2558 | shell_pgrp = getpid (); |
2559 | if (setpgid (shell_pgrp, shell_pgrp) < 0) { | 2559 | setpgid (shell_pgrp, shell_pgrp); |
2560 | perror_msg_and_die("Couldn't put the shell in its own process group"); | ||
2561 | } | ||
2562 | 2560 | ||
2563 | /* Grab control of the terminal. */ | 2561 | /* Grab control of the terminal. */ |
2564 | tcsetpgrp(shell_terminal, shell_pgrp); | 2562 | tcsetpgrp(shell_terminal, shell_pgrp); |
@@ -2607,11 +2605,12 @@ int shell_main(int argc, char **argv) | |||
2607 | 2605 | ||
2608 | if (argv[0] && argv[0][0] == '-') { | 2606 | if (argv[0] && argv[0][0] == '-') { |
2609 | debug_printf("\nsourcing /etc/profile\n"); | 2607 | debug_printf("\nsourcing /etc/profile\n"); |
2610 | input = xfopen("/etc/profile", "r"); | 2608 | if ((input = fopen("/etc/profile", "r")) != NULL) { |
2611 | mark_open(fileno(input)); | 2609 | mark_open(fileno(input)); |
2612 | parse_file_outer(input); | 2610 | parse_file_outer(input); |
2613 | mark_closed(fileno(input)); | 2611 | mark_closed(fileno(input)); |
2614 | fclose(input); | 2612 | fclose(input); |
2613 | } | ||
2615 | } | 2614 | } |
2616 | input=stdin; | 2615 | input=stdin; |
2617 | 2616 | ||