diff options
| author | Martin Schwenke <martin@meltin.net> | 2013-05-21 15:41:56 +1000 |
|---|---|---|
| committer | Martin Schwenke <martin@meltin.net> | 2013-05-24 16:04:50 +1000 |
| commit | 140f0cfd3b73ad2f1dbb6ce4870fc0be679fd4fd (patch) | |
| tree | 86d3970168f07c07d768447c3305e56fe5f248c8 | |
| parent | e78b064dcc0c6a0462574ae3193b3d4d24f5fac0 (diff) | |
| download | samba-140f0cfd3b73ad2f1dbb6ce4870fc0be679fd4fd.tar.gz samba-140f0cfd3b73ad2f1dbb6ce4870fc0be679fd4fd.tar.xz samba-140f0cfd3b73ad2f1dbb6ce4870fc0be679fd4fd.zip | |
ctdbd: Update the get_tunable code to return -EINVAL for unknown tunable
Otherwise callers can't tell the difference between some other failure
(e.g. memory allocation failure) and an unknown tunable.
Signed-off-by: Martin Schwenke <martin@meltin.net>
(This used to be ctdb commit 03fd90d41f9cd9b8c42dc6b8b8d46ae19101a544)
| -rw-r--r-- | ctdb/client/ctdb_client.c | 2 | ||||
| -rw-r--r-- | ctdb/server/ctdb_tunables.c | 2 | ||||
| -rw-r--r-- | ctdb/tools/ctdb.c | 2 |
3 files changed, 3 insertions, 3 deletions
diff --git a/ctdb/client/ctdb_client.c b/ctdb/client/ctdb_client.c index e930bffc39..665426cd92 100644 --- a/ctdb/client/ctdb_client.c +++ b/ctdb/client/ctdb_client.c @@ -2502,7 +2502,7 @@ int ctdb_ctrl_get_tunable(struct ctdb_context *ctdb, talloc_free(data.dptr); if (ret != 0 || res != 0) { DEBUG(DEBUG_ERR,(__location__ " ctdb_control for get_tunable failed\n")); - return -1; + return ret != 0 ? ret : res; } if (outdata.dsize != sizeof(uint32_t)) { diff --git a/ctdb/server/ctdb_tunables.c b/ctdb/server/ctdb_tunables.c index 84fb949007..365c6ba558 100644 --- a/ctdb/server/ctdb_tunables.c +++ b/ctdb/server/ctdb_tunables.c @@ -128,7 +128,7 @@ int32_t ctdb_control_get_tunable(struct ctdb_context *ctdb, TDB_DATA indata, talloc_free(name); if (i == ARRAY_SIZE(tunable_map)) { - return -1; + return -EINVAL; } val = *(uint32_t *)(tunable_map[i].offset + (uint8_t*)&ctdb->tunable); diff --git a/ctdb/tools/ctdb.c b/ctdb/tools/ctdb.c index 48ca93ba0e..b3cbade35e 100644 --- a/ctdb/tools/ctdb.c +++ b/ctdb/tools/ctdb.c @@ -4430,7 +4430,7 @@ static int control_getvar(struct ctdb_context *ctdb, int argc, const char **argv name = argv[0]; ret = ctdb_ctrl_get_tunable(ctdb, TIMELIMIT(), options.pnn, name, &value); - if (ret == -1) { + if (ret != 0) { DEBUG(DEBUG_ERR, ("Unable to get tunable variable '%s'\n", name)); return -1; } |
