mirror of
https://github.com/fish-shell/fish-shell
synced 2024-09-21 06:51:58 +00:00
Tweak fork guards to be more forgiving
Fixes https://github.com/fish-shell/fish-shell/issues/101
This commit is contained in:
parent
6cf42075fc
commit
34fd8e0e00
1 changed files with 4 additions and 1 deletions
|
@ -1943,9 +1943,12 @@ void configure_thread_assertions_for_testing(void) {
|
|||
}
|
||||
|
||||
/* Notice when we've forked */
|
||||
static pid_t initial_pid;
|
||||
static pid_t initial_pid = 0;
|
||||
|
||||
bool is_forked_child(void) {
|
||||
/* Just bail if nobody's called setup_fork_guards - e.g. fishd */
|
||||
if (! initial_pid) return false;
|
||||
|
||||
bool is_child_of_fork = (getpid() != initial_pid);
|
||||
if (is_child_of_fork) {
|
||||
printf("Uh-oh: %d\n", getpid());
|
||||
|
|
Loading…
Reference in a new issue