From: Martin Schwenke Date: Thu, 30 Aug 2018 22:42:04 +0000 (+1000) Subject: ctdb-common: Avoid ENOENT for unknown conf options X-Git-Tag: tdb-1.3.17~1893 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=920ed66ba7e874ca23d72fff9342fbd64a1e329f;p=thirdparty%2Fsamba.git ctdb-common: Avoid ENOENT for unknown conf options Only use ENOENT for missing configuration file. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13589 Signed-off-by: Martin Schwenke Reviewed-by: Amitay Isaacs --- diff --git a/ctdb/common/conf.c b/ctdb/common/conf.c index 2758d2628f2..8bc375b166d 100644 --- a/ctdb/common/conf.c +++ b/ctdb/common/conf.c @@ -1121,7 +1121,7 @@ static bool conf_load_option(const char *name, D_ERR("conf: unknown option [%s] -> \"%s\"\n", state->s->name, name); - state->err = ENOENT; + state->err = EINVAL; return false; } } @@ -1207,16 +1207,16 @@ static int conf_set(struct conf_context *conf, s = conf_section_find(conf, section); if (s == NULL) { - return ENOENT; + return EINVAL; } opt = conf_option_find(s, key); if (opt == NULL) { - return ENOENT; + return EINVAL; } if (opt->type != value->type) { - return ENOENT; + return EINVAL; } ok = conf_option_same_value(opt, value); @@ -1291,12 +1291,12 @@ static int conf_get(struct conf_context *conf, s = conf_section_find(conf, section); if (s == NULL) { - return ENOENT; + return EINVAL; } opt = conf_option_find(s, key); if (opt == NULL) { - return ENOENT; + return EINVAL; } if (opt->type != type) { diff --git a/ctdb/tests/cunit/conf_test_001.sh b/ctdb/tests/cunit/conf_test_001.sh index a1a84585b1e..caca9314953 100755 --- a/ctdb/tests/cunit/conf_test_001.sh +++ b/ctdb/tests/cunit/conf_test_001.sh @@ -120,7 +120,7 @@ cat > "$conffile" < "foo" [section1] # key1 = value1 diff --git a/ctdb/tests/cunit/config_test_001.sh b/ctdb/tests/cunit/config_test_001.sh index e58f710ac4d..d213aa88bfd 100755 --- a/ctdb/tests/cunit/config_test_001.sh +++ b/ctdb/tests/cunit/config_test_001.sh @@ -101,7 +101,7 @@ cat > "$conffile" < "unknown key" Failed to load config file $conffile EOF