ctdb-protocol: rindex->strrchr
authorVolker Lendecke <vl@samba.org>
Wed, 29 Dec 2021 14:10:28 +0000 (15:10 +0100)
committerVolker Lendecke <vl@samba.org>
Thu, 13 Jan 2022 16:13:38 +0000 (16:13 +0000)
According to "man rindex" on debian bullseye rindex() was deprecated
in Posix.1-2001 and removed from Posix.1-2008.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
ctdb/protocol/protocol_util.c

index 2d0a6f33038222e7737c706a8b844c69a67703be..1f1d874167a141181e5e2535526589ff045434a8 100644 (file)
@@ -230,10 +230,10 @@ static int ip_from_string(const char *str, ctdb_sock_addr *addr)
 
        /* IPv4 or IPv6 address?
         *
-        * Use rindex() because we need the right-most ':' below for
+        * Use strrchr() because we need the right-most ':' below for
         * IPv4-mapped IPv6 addresses anyway...
         */
-       p = rindex(str, ':');
+       p = strrchr(str, ':');
        if (p == NULL) {
                ret = ipv4_from_string(str, &addr->ip);
        } else {
@@ -286,7 +286,7 @@ int ctdb_sock_addr_from_string(const char *str,
                return EINVAL;
        }
 
-       p = rindex(s, ':');
+       p = strrchr(s, ':');
        if (p == NULL) {
                return EINVAL;
        }
@@ -324,7 +324,7 @@ int ctdb_sock_addr_mask_from_string(const char *str,
                return EINVAL;
        }
 
-       p = rindex(s, '/');
+       p = strrchr(s, '/');
        if (p == NULL) {
                return EINVAL;
        }