]> granicus.if.org Git - ipset/commitdiff
Fix to list/save into file specified by option
authorJozsef Kadlecsik <kadlec@blackhole.kfki.hu>
Sat, 10 Nov 2018 16:34:57 +0000 (17:34 +0100)
committerJozsef Kadlecsik <kadlec@blackhole.kfki.hu>
Sat, 10 Nov 2018 16:34:57 +0000 (17:34 +0100)
list/save into file given by "-f filename" did not work in 7.0,
reported by Isaac Good.

lib/ipset.c

index 8d05b39e96708c93bc912e3b75481a3aa976a6a9..4366e6007247aec2b5f51afaba8087158c64904f 100644 (file)
@@ -633,7 +633,7 @@ restore(struct ipset *ipset)
        if (ipset->filename) {
                ret = ipset_session_io_normal(session, ipset->filename,
                                              IPSET_IO_INPUT);
-               if (ret)
+               if (ret < 0)
                        return ret;
                f = ipset_session_io_stream(session, IPSET_IO_INPUT);
        }
@@ -1204,9 +1204,10 @@ ipset_parse_argv(struct ipset *ipset, int oargc, char *oargv[])
                if (ipset->filename != NULL) {
                        ret = ipset_session_io_normal(session,
                                        ipset->filename, IPSET_IO_OUTPUT);
-                       if (!ret)
+                       if (ret < 0)
                                return ret;
                }
+               /* Fall through to parse optional setname */
        case IPSET_CMD_DESTROY:
        case IPSET_CMD_FLUSH:
                /* Args: [setname] */