From: Jan Engelhardt <jengelh@medozas.de>
To: kaber@trash.net
Cc: netfilter-devel@vger.kernel.org
Subject: [PATCH 4/5] iptables: close open file descriptors
Date: Thu, 11 Jun 2009 13:11:21 +0200 [thread overview]
Message-ID: <1244718682-2497-5-git-send-email-jengelh@medozas.de> (raw)
In-Reply-To: <1244718682-2497-1-git-send-email-jengelh@medozas.de>
Just for correctness, close some file descriptors that were opened.
(E.g. ip6tables-save reading from procfs files.)
Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
---
ip6tables-restore.c | 2 ++
ip6tables-save.c | 1 +
iptables-restore.c | 2 ++
iptables-save.c | 1 +
iptables-xml.c | 2 ++
5 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/ip6tables-restore.c b/ip6tables-restore.c
index 1d5efea..06a82ae 100644
--- a/ip6tables-restore.c
+++ b/ip6tables-restore.c
@@ -454,5 +454,7 @@ int main(int argc, char *argv[])
exit(1);
}
+ if (in != NULL)
+ fclose(in);
return 0;
}
diff --git a/ip6tables-save.c b/ip6tables-save.c
index 97205c1..c59608f 100644
--- a/ip6tables-save.c
+++ b/ip6tables-save.c
@@ -54,6 +54,7 @@ static int for_each_table(int (*func)(const char *tablename))
ret &= func(tablename);
}
+ fclose(procfile);
return ret;
}
diff --git a/iptables-restore.c b/iptables-restore.c
index 2a797cc..5108fda 100644
--- a/iptables-restore.c
+++ b/iptables-restore.c
@@ -459,5 +459,7 @@ main(int argc, char *argv[])
exit(1);
}
+ if (in != NULL)
+ fclose(in);
return 0;
}
diff --git a/iptables-save.c b/iptables-save.c
index 6000b49..f63ee6b 100644
--- a/iptables-save.c
+++ b/iptables-save.c
@@ -52,6 +52,7 @@ static int for_each_table(int (*func)(const char *tablename))
ret &= func(tablename);
}
+ fclose(procfile);
return ret;
}
diff --git a/iptables-xml.c b/iptables-xml.c
index e5d1941..daf4208 100644
--- a/iptables-xml.c
+++ b/iptables-xml.c
@@ -870,6 +870,8 @@ main(int argc, char *argv[])
exit(1);
}
+ if (in != NULL)
+ fclose(in);
printf("</iptables-rules>\n");
free_argv();
--
1.6.3.1
next prev parent reply other threads:[~2009-06-11 11:11 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-11 11:11 June 11 iptables pull Jan Engelhardt
2009-06-11 11:11 ` [PATCH 1/5] libxt_tcp: fix a manpage syntax typo Jan Engelhardt
2009-06-11 11:11 ` [PATCH 2/5] libxt_tcp: manpage corrections and suggestions Jan Engelhardt
2009-06-11 11:11 ` [PATCH 3/5] libxt_connlimit: initialize v6_mask Jan Engelhardt
2009-06-11 11:11 ` Jan Engelhardt [this message]
2009-06-11 11:11 ` [PATCH 5/5] manpages: markup corrections Jan Engelhardt
2009-06-11 15:57 ` June 11 iptables pull Patrick McHardy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1244718682-2497-5-git-send-email-jengelh@medozas.de \
--to=jengelh@medozas.de \
--cc=kaber@trash.net \
--cc=netfilter-devel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).