}
}
-/**
- * Close all fds in the list and destroy all list entries.
- *
- * This function calls close(3) for each fd in the close-on-fork list
- * and empties the list afterwards.
- */
-void close_listed_fds(void)
+static void deplete_cof_list(bool close_fds)
{
struct close_on_fork *cof, *tmp;
return;
list_for_each_entry_safe(cof, tmp, &close_on_fork_list, node) {
PARA_DEBUG_LOG("closing fd %d\n", cof->fd);
- close(cof->fd);
+ if (close_fds)
+ close(cof->fd);
list_del(&cof->node);
free(cof);
}
}
+
+/**
+ * Close all fds in the list and destroy all list entries.
+ *
+ * This function calls close(3) for each fd in the close-on-fork list
+ * and empties the list afterwards.
+ *
+ * \sa \ref deplete_close_on_fork_list().
+ */
+void close_listed_fds(void)
+{
+ deplete_cof_list(true);
+}
+
+/**
+ * Remove all listed fds from the close on fork list.
+ *
+ * This is like \ref close_listed_fds() but does not close the fds.
+ */
+void deplete_close_on_fork_list(void)
+{
+ deplete_cof_list(false);
+}
void del_close_on_fork_list(int fd);
void add_close_on_fork_list(int fd);
void close_listed_fds(void);
+void deplete_close_on_fork_list(void);
daemon_set_hooks(NULL, NULL); /* only one process remaining */
mutex_destroy(log_mutex);
shm_detach(mmd);
+ deplete_close_on_fork_list();
if (ret < 0)
PARA_EMERG_LOG("%s\n", para_strerror(-ret));
} else {