ctdb-common: Fix CID 437606
authorAmitay Isaacs <amitay@gmail.com>
Wed, 4 Jul 2018 07:45:45 +0000 (17:45 +1000)
committerMartin Schwenke <martins@samba.org>
Thu, 5 Jul 2018 10:30:41 +0000 (12:30 +0200)
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
ctdb/common/conf.c

index 3c1369e138d270c3f4a957c2fd61f756c23086d8..74af7f8a048a9fda598dc4e2f2f2ef5f1e1e95e1 100644 (file)
@@ -1014,11 +1014,6 @@ static int conf_load_internal(struct conf_context *conf)
        int ret;
        bool ok;
 
-       fp = fopen(conf->filename, "r");
-       if (fp == NULL) {
-               return errno;
-       }
-
        state = (struct conf_load_state) {
                .conf = conf,
                .mode = (conf->reload ? CONF_MODE_RELOAD : CONF_MODE_LOAD),
@@ -1029,6 +1024,11 @@ static int conf_load_internal(struct conf_context *conf)
                return ret;
        }
 
+       fp = fopen(conf->filename, "r");
+       if (fp == NULL) {
+               return errno;
+       }
+
        ok = tini_parse(fp,
                        false,
                        conf_load_section,