summaryrefslogtreecommitdiffstats
path: root/libiptc
diff options
context:
space:
mode:
authorMartin Josefsson <gandalf@wlug.westbo.se>2003-06-13 16:56:51 +0000
committerMartin Josefsson <gandalf@wlug.westbo.se>2003-06-13 16:56:51 +0000
commite560fd604284180f3ab522993c5b8e6f424ef1d9 (patch)
tree40059e6e56afba6165f81dc4ff45585930712086 /libiptc
parent0c1b776db83c5d49a2ec53f575deda9fd2fa03fc (diff)
Fix possible doubleclose of sockfd.
This shouldn't break anything, things were already broken.
Diffstat (limited to 'libiptc')
-rw-r--r--libiptc/libiptc.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/libiptc/libiptc.c b/libiptc/libiptc.c
index fa735637..0dad6f48 100644
--- a/libiptc/libiptc.c
+++ b/libiptc/libiptc.c
@@ -1,4 +1,4 @@
-/* Library which manipulates firewall rules. Version $Revision: 1.36 $ */
+/* Library which manipulates firewall rules. Version $Revision: 1.37 $ */
/* Architecture of firewall rules is as follows:
*
@@ -234,8 +234,10 @@ TC_INIT(const char *tablename)
iptc_fn = TC_INIT;
- if (sockfd != -1)
+ if (sockfd != -1) {
close(sockfd);
+ sockfd = -1;
+ }
if (strlen(tablename) >= TABLE_MAXNAMELEN) {
errno = EINVAL;
@@ -255,6 +257,7 @@ TC_INIT(const char *tablename)
if ((h = alloc_handle(info.name, info.size, info.num_entries))
== NULL) {
close(sockfd);
+ sockfd = -1;
return NULL;
}
@@ -289,6 +292,7 @@ TC_INIT(const char *tablename)
if (getsockopt(sockfd, TC_IPPROTO, SO_GET_ENTRIES, &h->entries,
&tmp) < 0) {
close(sockfd);
+ sockfd = -1;
free(h);
return NULL;
}
@@ -301,6 +305,7 @@ void
TC_FREE(TC_HANDLE_T *h)
{
close(sockfd);
+ sockfd = -1;
if ((*h)->cache_chain_heads)
free((*h)->cache_chain_heads);
free(*h);