File arptables_jf-0.0.8-fclose.patch of Package arptables
--- arptables_jf-0.0.8/arptables-restore.c
+++ arptables_jf-0.0.8/arptables-restore.c 2009/09/07 11:06:26
@@ -140,7 +140,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", argv[optind],
strerror(errno));
--- arptables_jf-0.0.8/arptables-save.c
+++ arptables_jf-0.0.8/arptables-save.c 2009/09/07 11:05:47
@@ -241,13 +241,16 @@ static int for_each_table(int (*func)(co
while (fgets(tablename, sizeof(tablename), procfile)) {
- if (tablename[strlen(tablename) - 1] != '\n')
+ if (tablename[strlen(tablename) - 1] != '\n') {
+ fclose(procfile);
exit_error(OTHER_PROBLEM,
"Badly formed tablename `%s'\n",
tablename);
+ }
tablename[strlen(tablename) - 1] = '\0';
ret &= func(tablename);
}
+ fclose(procfile);
return ret;
}