]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUILD: sock_unix: fix build issue with isdigit()
authorWilly Tarreau <w@1wt.eu>
Sat, 29 Aug 2020 04:44:37 +0000 (06:44 +0200)
committerWilly Tarreau <w@1wt.eu>
Sat, 29 Aug 2020 04:44:37 +0000 (06:44 +0200)
Commit 0d06df6 ("MINOR: sock: introduce sock_inet and sock_unix")
made use of isdigit() on the UNIX socket path without casting the
value to unsigned char, breaking the build on cygwin and possibly
other platforms. No backport is needed.

src/sock_unix.c

index c4314d2e7fa6820e227375be6a712f7e7572076f..f68c0073af2b4a26737548c4701fbfd1d9f118ac 100644 (file)
@@ -80,7 +80,7 @@ int sock_unix_addrcmp(const struct sockaddr_storage *a, const struct sockaddr_st
 
        /* First, check in path "a" */
        if (au->sun_path[idx] != 0) {
-               for (idx2 = dot + 1; idx2 && isdigit(au->sun_path[idx2]);)
+               for (idx2 = dot + 1; idx2 && isdigit((unsigned char)au->sun_path[idx2]);)
                        idx2++;
                if (strcmp(au->sun_path + idx2, ".tmp") != 0)
                        return -1;
@@ -88,7 +88,7 @@ int sock_unix_addrcmp(const struct sockaddr_storage *a, const struct sockaddr_st
 
        /* Then check in path "b" */
        if (bu->sun_path[idx] != 0) {
-               for (idx2 = dot + 1; idx2 && isdigit(bu->sun_path[idx2]); idx2++)
+               for (idx2 = dot + 1; idx2 && isdigit((unsigned char)bu->sun_path[idx2]); idx2++)
                        ;
                if (strcmp(bu->sun_path + idx2, ".tmp") != 0)
                        return -1;