]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUILD: use MAXPATHLEN instead of NAME_MAX.
authorOlivier Houchard <ohouchard@haproxy.com>
Sat, 4 Nov 2017 14:13:01 +0000 (15:13 +0100)
committerWilly Tarreau <w@1wt.eu>
Sat, 4 Nov 2017 16:09:23 +0000 (17:09 +0100)
This fixes building on at least Solaris, where NAME_MAX doesn't exist.

src/cli.c
src/haproxy.c

index b546fd02bb7210bc78b7df3cce2b7f0a0a44e41b..9c77949451dd98e494ed137aed91220fc08486e2 100644 (file)
--- a/src/cli.c
+++ b/src/cli.c
@@ -1354,7 +1354,7 @@ static int _getsocks(char **args, struct appctx *appctx, void *private)
        /* We will send sockets MAX_SEND_FD per MAX_SEND_FD, allocate a
         * buffer big enough to store the socket informations.
         */
-       tmpbuf = malloc(MAX_SEND_FD * (1 + NAME_MAX + 1 + IFNAMSIZ + sizeof(int)));
+       tmpbuf = malloc(MAX_SEND_FD * (1 + MAXPATHLEN + 1 + IFNAMSIZ + sizeof(int)));
        if (tmpbuf == NULL) {
                Warning("Failed to allocate memory to transfer socket informations\n");
                goto out;
index d3db264ee5a10a99c267fb381daf305bf9869327..68b5e427b0d28c6b5b3a08d415907998c71c1e3c 100644 (file)
@@ -968,7 +968,7 @@ static int get_old_sockets(const char *unixsocket)
                ret = 0;
                goto out;
        }
-       tmpbuf = malloc(fd_nb * (1 + NAME_MAX + 1 + IFNAMSIZ + sizeof(int)));
+       tmpbuf = malloc(fd_nb * (1 + MAXPATHLEN + 1 + IFNAMSIZ + sizeof(int)));
        if (tmpbuf == NULL) {
                Warning("Failed to allocate memory while receiving sockets\n");
                goto out;
@@ -980,7 +980,7 @@ static int get_old_sockets(const char *unixsocket)
        }
        msghdr.msg_control = cmsgbuf;
        msghdr.msg_controllen = CMSG_SPACE(sizeof(int)) * MAX_SEND_FD;
-       iov.iov_len = MAX_SEND_FD * (1 + NAME_MAX + 1 + IFNAMSIZ + sizeof(int));
+       iov.iov_len = MAX_SEND_FD * (1 + MAXPATHLEN + 1 + IFNAMSIZ + sizeof(int));
        do {
                int ret3;