Fix getenv(SHELL)

This commit is contained in:
Night Kaly 2024-11-18 23:12:25 +00:00
parent 32f08816be
commit 4014407a34
Signed by: night0721
SSH key fingerprint: SHA256:B/hgVwUoBpx5vdNsXl9w8XwZljA9766uk6T4ubZp5HM

7
ccc.c
View file

@ -1304,10 +1304,12 @@ void start_shell(void)
bprintf("\033[2J\033[?25h"); bprintf("\033[2J\033[?25h");
move_cursor(1, 1); move_cursor(1, 1);
char shell[PATH_MAX]; char shell[PATH_MAX];
strcpy(shell, getenv("SHELL")); char *shellenv = getenv("SHELL");
if (strlen(shell) == 0) { if (!shellenv) {
strcpy(shell, "sh"); strcpy(shell, "sh");
} else { } else {
strcpy(shell, shellenv);
}
pid_t pid = fork(); pid_t pid = fork();
if (pid == 0) { if (pid == 0) {
/* Child process */ /* Child process */
@ -1322,7 +1324,6 @@ void start_shell(void)
wpprintw("fork failed: %s", strerror(errno)); wpprintw("fork failed: %s", strerror(errno));
} }
} }
}
void yank_clipboard(void) void yank_clipboard(void)
{ {