diff options
Diffstat (limited to 'libiptc')
-rw-r--r-- | libiptc/libiptc.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/libiptc/libiptc.c b/libiptc/libiptc.c index 13e41d52..63965e73 100644 --- a/libiptc/libiptc.c +++ b/libiptc/libiptc.c @@ -29,6 +29,8 @@ * - performance work: speedup initial ruleset parsing. * - sponsored by ComX Networks A/S (http://www.comx.dk/) */ +#include <unistd.h> +#include <fcntl.h> #include <sys/types.h> #include <sys/socket.h> #include <stdbool.h> @@ -1316,6 +1318,12 @@ TC_INIT(const char *tablename) if (sockfd < 0) return NULL; + if (fcntl(sockfd, F_SETFD, FD_CLOEXEC) == -1) { + fprintf(stderr, "Could not set close on exec: %s\n", + strerror(errno)); + abort(); + } + retry: s = sizeof(info); |