]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
ctdb: Update all consumers of strtoul_err(), strtoull_err() to new API
authorSwen Schillig <swen@linux.ibm.com>
Fri, 12 Apr 2019 14:58:13 +0000 (16:58 +0200)
committerRalph Boehme <slow@samba.org>
Sun, 30 Jun 2019 11:32:18 +0000 (11:32 +0000)
Signed-off-by: Swen Schillig <swen@linux.ibm.com>
Reviewed-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Christof Schmitt <cs@samba.org>
ctdb/protocol/protocol_util.c
ctdb/server/ctdb_recovery_helper.c
ctdb/tools/ctdb.c

index f43afbc58d00b30453387a71c0b995ecc866203b..2a0d42a9f45eb68416541b8fc72220191636e4e1 100644 (file)
@@ -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;
        }
index f2ea9b1fd566dc6a8c80b72cf2ac16d03173fe73..0597c507ba6edb2f9c1098bb6cb05728912b5515 100644 (file)
@@ -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;
index d79945460f9b9562cdb00d934acd4484c713b251..9d46c981a0f5f4954d0105dd5838407a9d406429 100644 (file)
@@ -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);