Don't choke if /etc/profile is not available
This commit is contained in:
7
hush.c
7
hush.c
@ -2556,9 +2556,7 @@ static void setup_job_control()
|
|||||||
|
|
||||||
/* Put ourselves in our own process group. */
|
/* Put ourselves in our own process group. */
|
||||||
shell_pgrp = getpid ();
|
shell_pgrp = getpid ();
|
||||||
if (setpgid (shell_pgrp, shell_pgrp) < 0) {
|
setpgid (shell_pgrp, shell_pgrp);
|
||||||
perror_msg_and_die("Couldn't put the shell in its own process group");
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Grab control of the terminal. */
|
/* Grab control of the terminal. */
|
||||||
tcsetpgrp(shell_terminal, shell_pgrp);
|
tcsetpgrp(shell_terminal, shell_pgrp);
|
||||||
@ -2607,12 +2605,13 @@ int shell_main(int argc, char **argv)
|
|||||||
|
|
||||||
if (argv[0] && argv[0][0] == '-') {
|
if (argv[0] && argv[0][0] == '-') {
|
||||||
debug_printf("\nsourcing /etc/profile\n");
|
debug_printf("\nsourcing /etc/profile\n");
|
||||||
input = xfopen("/etc/profile", "r");
|
if ((input = fopen("/etc/profile", "r")) != NULL) {
|
||||||
mark_open(fileno(input));
|
mark_open(fileno(input));
|
||||||
parse_file_outer(input);
|
parse_file_outer(input);
|
||||||
mark_closed(fileno(input));
|
mark_closed(fileno(input));
|
||||||
fclose(input);
|
fclose(input);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
input=stdin;
|
input=stdin;
|
||||||
|
|
||||||
while ((opt = getopt(argc, argv, "c:xif")) > 0) {
|
while ((opt = getopt(argc, argv, "c:xif")) > 0) {
|
||||||
|
@ -2556,9 +2556,7 @@ static void setup_job_control()
|
|||||||
|
|
||||||
/* Put ourselves in our own process group. */
|
/* Put ourselves in our own process group. */
|
||||||
shell_pgrp = getpid ();
|
shell_pgrp = getpid ();
|
||||||
if (setpgid (shell_pgrp, shell_pgrp) < 0) {
|
setpgid (shell_pgrp, shell_pgrp);
|
||||||
perror_msg_and_die("Couldn't put the shell in its own process group");
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Grab control of the terminal. */
|
/* Grab control of the terminal. */
|
||||||
tcsetpgrp(shell_terminal, shell_pgrp);
|
tcsetpgrp(shell_terminal, shell_pgrp);
|
||||||
@ -2607,12 +2605,13 @@ int shell_main(int argc, char **argv)
|
|||||||
|
|
||||||
if (argv[0] && argv[0][0] == '-') {
|
if (argv[0] && argv[0][0] == '-') {
|
||||||
debug_printf("\nsourcing /etc/profile\n");
|
debug_printf("\nsourcing /etc/profile\n");
|
||||||
input = xfopen("/etc/profile", "r");
|
if ((input = fopen("/etc/profile", "r")) != NULL) {
|
||||||
mark_open(fileno(input));
|
mark_open(fileno(input));
|
||||||
parse_file_outer(input);
|
parse_file_outer(input);
|
||||||
mark_closed(fileno(input));
|
mark_closed(fileno(input));
|
||||||
fclose(input);
|
fclose(input);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
input=stdin;
|
input=stdin;
|
||||||
|
|
||||||
while ((opt = getopt(argc, argv, "c:xif")) > 0) {
|
while ((opt = getopt(argc, argv, "c:xif")) > 0) {
|
||||||
|
Reference in New Issue
Block a user