Hi tech@,

The following patch fixes file descriptor leak in `dofile' function.
Sorry if I am wrong, thanks!

Index: nohup.c
===================================================================
RCS file: /cvs/src/usr.bin/nohup/nohup.c,v
retrieving revision 1.17
diff -u -p -r1.17 nohup.c
--- nohup.c     26 Apr 2018 12:42:51 -0000      1.17
+++ nohup.c     8 Sep 2018 02:54:48 -0000
@@ -125,6 +125,7 @@ dupit:
        (void)lseek(fd, (off_t)0, SEEK_END);
        if (dup2(fd, STDOUT_FILENO) == -1)
                err(EXIT_MISC, NULL);
+       (void)close(fd);
        (void)fprintf(stderr, "sending output to %s\n", p);
 }


-- 
Best Regards
Nan Xiao

Reply via email to