Exit with error if starting as 'arsh file' and file can't be opened
This commit is contained in:
parent
ea8284be82
commit
d20c1c429e
1 changed files with 6 additions and 1 deletions
7
main.c
7
main.c
|
|
@ -1004,7 +1004,7 @@ char* generate_ps1_prompt()
|
|||
}
|
||||
if(ps1_len < 2)
|
||||
{
|
||||
copy_str_to_buf(prompt_buf, sizeof(prompt_buf), getenv("PS1"));
|
||||
copy_str_to_buf(prompt_buf, sizeof(prompt_buf), env_buf);
|
||||
return prompt_buf;
|
||||
}
|
||||
size_t i = 1, j = 0;
|
||||
|
|
@ -1077,6 +1077,11 @@ int main(int argc, const char* argv[])
|
|||
stream = file;
|
||||
prompt = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
perror(argv[1]);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
struct sigaction s;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue