]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/lib/daemon.c
Add support for fcntl(fd, F_CLOSEM) to close filedescriptors.
[bacula/bacula] / bacula / src / lib / daemon.c
index e736b362179d44391226c9fb4340c7a70bbcec41..72b3365caaa7cabba83aa51942e72f771df251c3 100644 (file)
@@ -77,7 +77,15 @@ daemon_start()
       low_fd = 2;                     /* don't close debug output */
    }
 
-#ifdef HAVE_CLOSEFROM
+#if defined(HAVE_FCNTL_F_CLOSEM)
+   /*
+    * fcntl(fd, F_CLOSEM) needs the minimum filedescriptor
+    * to close. the current code sets the last one to keep
+    * open. So increment it with 1 and use that as argument.
+    */
+   low_fd++;
+   fcntl(low_fd, F_CLOSEM);
+#elif defined(HAVE_CLOSEFROM)
    /*
     * closefrom needs the minimum filedescriptor to close.
     * the current code sets the last one to keep open.