diff options
author | Martin Schwenke <martin@meltin.net> | 2018-08-31 08:42:04 +1000 |
---|---|---|
committer | Amitay Isaacs <amitay@samba.org> | 2018-09-03 10:52:11 +0200 |
commit | 920ed66ba7e874ca23d72fff9342fbd64a1e329f (patch) | |
tree | defe8941b96fad94b1109e6228b817d2a530b31e /ctdb | |
parent | f1084400387c0b1257b6d92ee6e8a89504d788fc (diff) | |
download | samba-920ed66ba7e874ca23d72fff9342fbd64a1e329f.tar.gz |
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 <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
Diffstat (limited to 'ctdb')
-rw-r--r-- | ctdb/common/conf.c | 12 | ||||
-rwxr-xr-x | ctdb/tests/cunit/conf_test_001.sh | 2 | ||||
-rwxr-xr-x | ctdb/tests/cunit/config_test_001.sh | 2 |
3 files changed, 8 insertions, 8 deletions
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" <<EOF key2 = 20 EOF -required_result 2 <<EOF +required_error EINVAL <<EOF conf: unknown option [section1] -> "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" <<EOF log level = debug EOF -required_result 2 <<EOF +required_error EINVAL <<EOF conf: unknown option [database] -> "unknown key" Failed to load config file $conffile EOF |