]> Sergey Matveev's repositories - nnn.git/commitdiff
Use _exit() to terminate children
authorArun Prakash Jana <engineerarun@gmail.com>
Sat, 1 Feb 2020 13:58:59 +0000 (19:28 +0530)
committerArun Prakash Jana <engineerarun@gmail.com>
Sat, 1 Feb 2020 13:58:59 +0000 (19:28 +0530)
The NNN_PIPE file gets deleted after spawning a child in NOWAIT mode. Steps:
- open `nnn` with option `-x`
- press `;o` (custom binding) to open fzopen plugin
- press `^J` to select a file; it will spawn plugin `.cbcp` in NOWAIT mode
- when the intermediate child quits, the NNN_PIPE of parent is also deleted

src/nnn.c

index a98237beb8ca3cb9a3cb49d43463fdec12de6db7..133660d2141554373a1c70defaa173b6e71ee9ff 100644 (file)
--- a/src/nnn.c
+++ b/src/nnn.c
@@ -1302,7 +1302,7 @@ static pid_t xfork(uchar flag)
                        p = fork();
 
                        if (p > 0)
-                               exit(0);
+                               _exit(0);
                        else if (p == 0) {
                                signal(SIGHUP, SIG_DFL);
                                signal(SIGINT, SIG_DFL);
@@ -1314,7 +1314,7 @@ static pid_t xfork(uchar flag)
                        }
 
                        perror("fork");
-                       exit(0);
+                       _exit(0);
                }
 
                /* so they can be used to stop the child */