mirror of
https://gitlab.com/sortix/sortix.git
synced 2023-02-13 20:55:38 -05:00
Fix shell crash if PWD is unset.
This commit is contained in:
parent
754a10e274
commit
a041c107d5
1 changed files with 7 additions and 1 deletions
|
@ -34,6 +34,12 @@
|
|||
|
||||
int status = 0;
|
||||
|
||||
const char* getenv_safe(const char* name)
|
||||
{
|
||||
const char* ret = getenv(name);
|
||||
return ret ? ret : "";
|
||||
}
|
||||
|
||||
void on_sigint(int /*signum*/)
|
||||
{
|
||||
printf("^C\n");
|
||||
|
@ -267,7 +273,7 @@ void get_and_run_command()
|
|||
| TERMMODE_ECHO;
|
||||
settermmode(0, termmode);
|
||||
|
||||
printf("root@sortix %s # ", getenv("PWD"));
|
||||
printf("root@sortix %s # ", getenv_safe("PWD"));
|
||||
fflush(stdout);
|
||||
|
||||
const size_t commandsize = 1024;
|
||||
|
|
Loading…
Add table
Reference in a new issue