aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2001-06-26 23:00:21 +0000
committerEric Andersen <andersen@codepoet.org>2001-06-26 23:00:21 +0000
commita90f20b1c330bef928e99031e710836024fcaf5f (patch)
treea2ba0790f64c246b8e95d6204b90124ce7d1e5f1
parentd98337a7b49f389973a3138230f55e27d754e926 (diff)
downloadbusybox-a90f20b1c330bef928e99031e710836024fcaf5f.tar.gz
Don't choke if /etc/profile is not available
-rw-r--r--hush.c15
-rw-r--r--shell/hush.c15
2 files changed, 14 insertions, 16 deletions
diff --git a/hush.c b/hush.c
index 859353dcf..f70074f14 100644
--- a/hush.c
+++ b/hush.c
@@ -2556,9 +2556,7 @@ static void setup_job_control()
/* Put ourselves in our own process group. */
shell_pgrp = getpid ();
- if (setpgid (shell_pgrp, shell_pgrp) < 0) {
- perror_msg_and_die("Couldn't put the shell in its own process group");
- }
+ setpgid (shell_pgrp, shell_pgrp);
/* Grab control of the terminal. */
tcsetpgrp(shell_terminal, shell_pgrp);
@@ -2607,11 +2605,12 @@ int shell_main(int argc, char **argv)
if (argv[0] && argv[0][0] == '-') {
debug_printf("\nsourcing /etc/profile\n");
- input = xfopen("/etc/profile", "r");
- mark_open(fileno(input));
- parse_file_outer(input);
- mark_closed(fileno(input));
- fclose(input);
+ if ((input = fopen("/etc/profile", "r")) != NULL) {
+ mark_open(fileno(input));
+ parse_file_outer(input);
+ mark_closed(fileno(input));
+ fclose(input);
+ }
}
input=stdin;
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()
/* Put ourselves in our own process group. */
shell_pgrp = getpid ();
- if (setpgid (shell_pgrp, shell_pgrp) < 0) {
- perror_msg_and_die("Couldn't put the shell in its own process group");
- }
+ setpgid (shell_pgrp, shell_pgrp);
/* Grab control of the terminal. */
tcsetpgrp(shell_terminal, shell_pgrp);
@@ -2607,11 +2605,12 @@ int shell_main(int argc, char **argv)
if (argv[0] && argv[0][0] == '-') {
debug_printf("\nsourcing /etc/profile\n");
- input = xfopen("/etc/profile", "r");
- mark_open(fileno(input));
- parse_file_outer(input);
- mark_closed(fileno(input));
- fclose(input);
+ if ((input = fopen("/etc/profile", "r")) != NULL) {
+ mark_open(fileno(input));
+ parse_file_outer(input);
+ mark_closed(fileno(input));
+ fclose(input);
+ }
}
input=stdin;