Browse Source

Fix an fd leak in start_daemon

svn:r4508
Nick Mathewson 20 years ago
parent
commit
584a0ae397
1 changed files with 2 additions and 0 deletions
  1. 2 0
      src/common/util.c

+ 2 - 0
src/common/util.c

@@ -1418,6 +1418,8 @@ void finish_daemon(const char *desired_cwd)
     log_fn(LOG_ERR,"dup2 failed. Exiting.");
     exit(1);
   }
+  if (nullfd > 2)
+    close(nullfd);
   write(daemon_filedes[1], &c, sizeof(char)); /* signal success */
   close(daemon_filedes[1]);
 }