Exit with error if starting as 'arsh file' and file can't be opened

This commit is contained in:
Aleksandr Lebedev 2026-04-21 17:40:29 +02:00
parent ea8284be82
commit d20c1c429e

7
main.c
View file

@ -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;