diff options
author | Swen Schillig <swen@linux.ibm.com> | 2019-04-12 16:58:13 +0200 |
---|---|---|
committer | Ralph Boehme <slow@samba.org> | 2019-06-30 11:32:18 +0000 |
commit | 73640b8ad8ced213d4855a2698df0d15318696ac (patch) | |
tree | 61cc4ef19ad9541a733cdcd10050d37613e324a4 /ctdb | |
parent | b1c2f168ceff3e425462563fe5f73a655c77b47e (diff) | |
download | samba-73640b8ad8ced213d4855a2698df0d15318696ac.tar.gz |
ctdb: Update all consumers of strtoul_err(), strtoull_err() to new API
Signed-off-by: Swen Schillig <swen@linux.ibm.com>
Reviewed-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Christof Schmitt <cs@samba.org>
Diffstat (limited to 'ctdb')
-rw-r--r-- | ctdb/protocol/protocol_util.c | 10 | ||||
-rw-r--r-- | ctdb/server/ctdb_recovery_helper.c | 6 | ||||
-rw-r--r-- | ctdb/tools/ctdb.c | 30 |
3 files changed, 30 insertions, 16 deletions
diff --git a/ctdb/protocol/protocol_util.c b/ctdb/protocol/protocol_util.c index f43afbc58d0..2a0d42a9f45 100644 --- a/ctdb/protocol/protocol_util.c +++ b/ctdb/protocol/protocol_util.c @@ -270,7 +270,6 @@ int ctdb_sock_addr_from_string(const char *str, char *p; char s[64]; /* Much longer than INET6_ADDRSTRLEN */ unsigned port; - char *endp = NULL; size_t len; int ret; @@ -291,8 +290,8 @@ int ctdb_sock_addr_from_string(const char *str, return EINVAL; } - port = strtoul_err(p+1, &endp, 10, &ret); - if (ret != 0 || *endp != '\0') { + port = smb_strtoul(p+1, NULL, 10, &ret, SMB_STR_FULL_STR_CONV); + if (ret != 0) { /* Empty string or trailing garbage */ return EINVAL; } @@ -312,7 +311,6 @@ int ctdb_sock_addr_mask_from_string(const char *str, char *p; char s[64]; /* Much longer than INET6_ADDRSTRLEN */ unsigned int m; - char *endp = NULL; ssize_t len; int ret = 0; @@ -330,8 +328,8 @@ int ctdb_sock_addr_mask_from_string(const char *str, return EINVAL; } - m = strtoul_err(p+1, &endp, 10, &ret); - if (ret != 0 || *endp != '\0') { + m = smb_strtoul(p+1, NULL, 10, &ret, SMB_STR_FULL_STR_CONV); + if (ret != 0) { /* Empty string or trailing garbage */ return EINVAL; } diff --git a/ctdb/server/ctdb_recovery_helper.c b/ctdb/server/ctdb_recovery_helper.c index f2ea9b1fd56..0597c507ba6 100644 --- a/ctdb/server/ctdb_recovery_helper.c +++ b/ctdb/server/ctdb_recovery_helper.c @@ -2752,7 +2752,11 @@ int main(int argc, char *argv[]) write_fd = atoi(argv[1]); sockpath = argv[2]; - generation = (uint32_t)strtoul_err(argv[3], NULL, 0, &ret); + generation = (uint32_t)smb_strtoul(argv[3], + NULL, + 0, + &ret, + SMB_STR_STANDARD); if (ret != 0) { fprintf(stderr, "recovery: unable to initialize generation\n"); goto failed; diff --git a/ctdb/tools/ctdb.c b/ctdb/tools/ctdb.c index d79945460f9..9d46c981a0f 100644 --- a/ctdb/tools/ctdb.c +++ b/ctdb/tools/ctdb.c @@ -326,7 +326,11 @@ static bool parse_nodestring(TALLOC_CTX *mem_ctx, struct ctdb_context *ctdb, while (tok != NULL) { uint32_t pnn; - pnn = (uint32_t)strtoul_err(tok, NULL, 0, &error); + pnn = (uint32_t)smb_strtoul(tok, + NULL, + 0, + &error, + SMB_STR_STANDARD); if (error != 0) { fprintf(stderr, "Invalid node %s\n", tok); return false; @@ -546,7 +550,7 @@ static bool db_exists(TALLOC_CTX *mem_ctx, struct ctdb_context *ctdb, } if (strncmp(db_arg, "0x", 2) == 0) { - id = strtoul_err(db_arg, NULL, 0, &ret); + id = smb_strtoul(db_arg, NULL, 0, &ret, SMB_STR_STANDARD); if (ret != 0) { return false; } @@ -1096,7 +1100,7 @@ static int control_setvar(TALLOC_CTX *mem_ctx, struct ctdb_context *ctdb, } tunable.name = argv[0]; - tunable.value = strtoul_err(argv[1], NULL, 0, &ret); + tunable.value = smb_strtoul(argv[1], NULL, 0, &ret, SMB_STR_STANDARD); if (ret != 0) { return ret; } @@ -1891,7 +1895,7 @@ static int control_process_exists(TALLOC_CTX *mem_ctx, pid = atoi(argv[0]); if (argc == 2) { - srvid = strtoull_err(argv[1], NULL, 0, &ret); + srvid = smb_strtoull(argv[1], NULL, 0, &ret, SMB_STR_STANDARD); if (ret != 0) { return ret; } @@ -2802,7 +2806,7 @@ static int control_ban(TALLOC_CTX *mem_ctx, struct ctdb_context *ctdb, } ban_state.pnn = ctdb->cmd_pnn; - ban_state.time = strtoul_err(argv[0], NULL, 0, &ret); + ban_state.time = smb_strtoul(argv[0], NULL, 0, &ret, SMB_STR_STANDARD); if (ret != 0) { return ret; } @@ -3126,7 +3130,7 @@ static int control_gettickles(TALLOC_CTX *mem_ctx, struct ctdb_context *ctdb, } if (argc == 2) { - port = strtoul_err(argv[1], NULL, 10, &ret); + port = smb_strtoul(argv[1], NULL, 10, &ret, SMB_STR_STANDARD); if (ret != 0) { return ret; } @@ -3837,7 +3841,7 @@ static int control_moveip(TALLOC_CTX *mem_ctx, struct ctdb_context *ctdb, return 1; } - pnn = strtoul_err(argv[1], NULL, 10, &ret); + pnn = smb_strtoul(argv[1], NULL, 10, &ret, SMB_STR_STANDARD); if (pnn == CTDB_UNKNOWN_PNN || ret != 0) { fprintf(stderr, "Invalid PNN %s\n", argv[1]); return 1; @@ -5294,7 +5298,11 @@ static int control_tstore(TALLOC_CTX *mem_ctx, struct ctdb_context *ctdb, ZERO_STRUCT(header); if (argc > 3) { - header.rsn = (uint64_t)strtoull_err(argv[3], NULL, 0, &ret); + header.rsn = (uint64_t)smb_strtoull(argv[3], + NULL, + 0, + &ret, + SMB_STR_STANDARD); if (ret != 0) { return ret; } @@ -6311,7 +6319,11 @@ int main(int argc, const char *argv[]) ctdb_timeout = getenv("CTDB_TIMEOUT"); if (ctdb_timeout != NULL) { - options.maxruntime = strtoul_err(ctdb_timeout, NULL, 0, &ret); + options.maxruntime = smb_strtoul(ctdb_timeout, + NULL, + 0, + &ret, + SMB_STR_STANDARD); if (ret != 0) { fprintf(stderr, "Invalid value CTDB_TIMEOUT\n"); exit(1); |