77 lines
3.0 KiB
Diff
77 lines
3.0 KiB
Diff
diff -up iptables-1.4.0/iptables-save.c.cloexec iptables-1.4.0/iptables-save.c
|
|
--- iptables-1.4.0/iptables-save.c.cloexec 2008-03-20 15:17:38.000000000 +0100
|
|
+++ iptables-1.4.0/iptables-save.c 2008-03-20 15:17:40.000000000 +0100
|
|
@@ -255,7 +255,7 @@ static int for_each_table(int (*func)(co
|
|
FILE *procfile = NULL;
|
|
char tablename[IPT_TABLE_MAXNAMELEN+1];
|
|
|
|
- procfile = fopen("/proc/net/ip_tables_names", "r");
|
|
+ procfile = fopen("/proc/net/ip_tables_names", "re");
|
|
if (!procfile)
|
|
exit_error(OTHER_PROBLEM,
|
|
"Unable to open /proc/net/ip_tables_names: %s\n",
|
|
diff -up iptables-1.4.0/ip6tables-save.c.cloexec iptables-1.4.0/ip6tables-save.c
|
|
--- iptables-1.4.0/ip6tables-save.c.cloexec 2008-03-20 15:17:40.000000000 +0100
|
|
+++ iptables-1.4.0/ip6tables-save.c 2008-03-20 15:17:40.000000000 +0100
|
|
@@ -232,7 +232,7 @@ static int for_each_table(int (*func)(co
|
|
FILE *procfile = NULL;
|
|
char tablename[IP6T_TABLE_MAXNAMELEN+1];
|
|
|
|
- procfile = fopen("/proc/net/ip6_tables_names", "r");
|
|
+ procfile = fopen("/proc/net/ip6_tables_names", "re");
|
|
if (!procfile)
|
|
exit_error(OTHER_PROBLEM,
|
|
"Unable to open /proc/net/ip6_tables_names: %s\n",
|
|
diff -up iptables-1.4.0/ip6tables-restore.c.cloexec iptables-1.4.0/ip6tables-restore.c
|
|
--- iptables-1.4.0/ip6tables-restore.c.cloexec 2008-03-20 15:21:36.000000000 +0100
|
|
+++ iptables-1.4.0/ip6tables-restore.c 2008-03-20 15:21:53.000000000 +0100
|
|
@@ -165,7 +165,7 @@ int main(int argc, char *argv[])
|
|
}
|
|
|
|
if (optind == argc - 1) {
|
|
- in = fopen(argv[optind], "r");
|
|
+ in = fopen(argv[optind], "re");
|
|
if (!in) {
|
|
fprintf(stderr, "Can't open %s: %s\n", argv[optind],
|
|
strerror(errno));
|
|
diff -up iptables-1.4.0/iptables-xml.c.cloexec iptables-1.4.0/iptables-xml.c
|
|
--- iptables-1.4.0/iptables-xml.c.cloexec 2008-03-20 15:17:40.000000000 +0100
|
|
+++ iptables-1.4.0/iptables-xml.c 2008-03-20 15:17:38.000000000 +0100
|
|
@@ -664,7 +664,7 @@ main(int argc, char *argv[])
|
|
}
|
|
|
|
if (optind == argc - 1) {
|
|
- in = fopen(argv[optind], "r");
|
|
+ in = fopen(argv[optind], "re");
|
|
if (!in) {
|
|
fprintf(stderr, "Can't open %s: %s", argv[optind],
|
|
strerror(errno));
|
|
diff -up iptables-1.4.0/iptables-restore.c.cloexec iptables-1.4.0/iptables-restore.c
|
|
--- iptables-1.4.0/iptables-restore.c.cloexec 2008-03-20 15:17:40.000000000 +0100
|
|
+++ iptables-1.4.0/iptables-restore.c 2008-03-20 15:17:40.000000000 +0100
|
|
@@ -170,7 +170,7 @@ main(int argc, char *argv[])
|
|
}
|
|
|
|
if (optind == argc - 1) {
|
|
- in = fopen(argv[optind], "r");
|
|
+ in = fopen(argv[optind], "re");
|
|
if (!in) {
|
|
fprintf(stderr, "Can't open %s: %s\n", argv[optind],
|
|
strerror(errno));
|
|
diff -up iptables-1.4.0/xtables.c.cloexec iptables-1.4.0/xtables.c
|
|
--- iptables-1.4.0/xtables.c.cloexec 2008-03-20 15:17:40.000000000 +0100
|
|
+++ iptables-1.4.0/xtables.c 2008-03-20 15:17:40.000000000 +0100
|
|
@@ -428,6 +428,12 @@ static int compatible_revision(const cha
|
|
exit(1);
|
|
}
|
|
|
|
+ if (fcntl(sockfd, F_SETFD, FD_CLOEXEC) == -1) {
|
|
+ fprintf(stderr, "Could not set close on exec: %s\n",
|
|
+ strerror(errno));
|
|
+ exit(1);
|
|
+ }
|
|
+
|
|
load_xtables_ko(modprobe, 1);
|
|
|
|
strcpy(rev.name, name);
|