From 895992619d521e987d25644ad859adef7e8d646b Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Tue, 15 Sep 2020 14:03:26 +0200 Subject: [PATCH] MINOR: log: detect LOG_TARGET_FD from the fd and not from the syntax 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 | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/log.c b/src/log.c index fcb16f6be..a0898aadc 100644 --- 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 */