projects
/
paraslash.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'maint' into next
[paraslash.git]
/
close_on_fork.c
diff --git
a/close_on_fork.c
b/close_on_fork.c
index 299aab0b0f613750481657951837da1626ed9aff..fb1906462b30b74935a64d53370c9810046df771 100644
(file)
--- a/
close_on_fork.c
+++ b/
close_on_fork.c
@@
-5,6
+5,9
@@
*/
/** \file close_on_fork.c Manage a list of fds that should be closed on fork. */
*/
/** \file close_on_fork.c Manage a list of fds that should be closed on fork. */
+
+#include <regex.h>
+
#include "para.h"
#include "list.h"
#include "string.h"
#include "para.h"
#include "list.h"
#include "string.h"
@@
-63,16
+66,21
@@
void del_close_on_fork_list(int fd)
}
/**
}
/**
- * Call close(3) for each fd in the close-on-fork list.
+ * 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)
{
*/
void close_listed_fds(void)
{
- struct close_on_fork *cof;
+ struct close_on_fork *cof
, *tmp
;
if (!initialized)
return;
if (!initialized)
return;
- list_for_each_entry
(cof
, &close_on_fork_list, node) {
+ list_for_each_entry
_safe(cof, tmp
, &close_on_fork_list, node) {
PARA_DEBUG_LOG("closing fd %d\n", cof->fd);
close(cof->fd);
PARA_DEBUG_LOG("closing fd %d\n", cof->fd);
close(cof->fd);
+ list_del(&cof->node);
+ free(cof);
}
}
}
}