]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: log: detect LOG_TARGET_FD from the fd and not from the syntax
authorWilly Tarreau <w@1wt.eu>
Tue, 15 Sep 2020 12:03:26 +0000 (14:03 +0200)
committerWilly Tarreau <w@1wt.eu>
Wed, 16 Sep 2020 20:08:08 +0000 (22:08 +0200)
Now that we have the FD value reported we don't need to cheat and detect
"fd@" in the address, we can safely rely on the FD value.

src/log.c

index fcb16f6be2d9787d589b686dcb243c2fb6d0a1dc..a0898aadce0fe0eb383695503714cdf79c3d6f74 100644 (file)
--- a/src/log.c
+++ b/src/log.c
@@ -803,6 +803,7 @@ int parse_logsrv(char **args, struct list *logsrvs, int do_del, char **err)
        struct logsrv *logsrv = NULL;
        int port1, port2;
        int cur_arg;
+       int fd;
 
        /*
         * "no log": delete previous herited or defined syslog
@@ -1018,13 +1019,13 @@ int parse_logsrv(char **args, struct list *logsrvs, int do_del, char **err)
                goto done;
        }
 
-       if (strncmp(args[1], "fd@", 3) == 0)
-               logsrv->type = LOG_TARGET_FD;
-
-       sk = str2sa_range(args[1], NULL, &port1, &port2, NULL,
+       sk = str2sa_range(args[1], NULL, &port1, &port2, &fd,
                          err, NULL, NULL, PA_O_RESOLVE | PA_O_PORT_OK | PA_O_RAW_FD | PA_O_DGRAM);
        if (!sk)
                goto error;
+
+       if (fd != -1)
+               logsrv->type = LOG_TARGET_FD;
        logsrv->addr = *sk;
 
        /* handle nicely the case where "udp@" is forced */