diff options
Diffstat (limited to 'iptables/ip6tables-save.c')
-rw-r--r-- | iptables/ip6tables-save.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/iptables/ip6tables-save.c b/iptables/ip6tables-save.c index f35e921e..053413a9 100644 --- a/iptables/ip6tables-save.c +++ b/iptables/ip6tables-save.c @@ -35,10 +35,16 @@ static int for_each_table(int (*func)(const char *tablename)) int ret = 1; FILE *procfile = NULL; char tablename[XT_TABLE_MAXNAMELEN+1]; - - procfile = fopen("/proc/net/ip6_tables_names", "re"); - if (!procfile) - return ret; + static const char filename[] = "/proc/net/ip6_tables_names"; + + procfile = fopen(filename, "re"); + if (!procfile) { + if (errno == ENOENT) + return ret; + fprintf(stderr, "Failed to list table names in %s: %s\n", + filename, strerror(errno)); + exit(1); + } while (fgets(tablename, sizeof(tablename), procfile)) { if (tablename[strlen(tablename) - 1] != '\n') |