]> Sergey Matveev's repositories - nnn.git/commitdiff
Prevent open FIFO prom leaking to subprocess
authorLéo Villeveygoux <l@vgx.fr>
Tue, 5 May 2020 23:45:21 +0000 (01:45 +0200)
committerLéo Villeveygoux <l@vgx.fr>
Tue, 5 May 2020 23:45:21 +0000 (01:45 +0200)
This fix previews window staying open after nnn exits, because they
inherited open FIFO (in write mode) from parent nnn process, and never
close it.

src/nnn.c

index 069599b3e18a4dfbf45d8e1f88a23a5f31d1d9f9..73e656ce2b14d3645c025b7b0fa5266ce0b2cc09 100644 (file)
--- a/src/nnn.c
+++ b/src/nnn.c
@@ -4679,7 +4679,7 @@ static void populate(char *path, char *lastname)
 static void notify_fifo()
 {
        if (fifofd == -1) {
-               fifofd = open(fifopath, O_WRONLY|O_NONBLOCK);
+               fifofd = open(fifopath, O_WRONLY|O_NONBLOCK|O_CLOEXEC);
                if (fifofd == -1) {
                        if (errno != ENXIO)
                                /* Unexpected error, the FIFO file might have been removed */