mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-22 14:21:25 +02:00
BUG/MEDIUM: log: don't mark log FDs as non-blocking on terminals
With the new ability to log to a terminal, it's convenient to be able to use "log stdout" in a config file, except that it now results in setting the terminal to non-blocking mode, breaking every utility relying on stdin afterwards. Since the only reason for logging to a terminal is to debug, do not set the FD to non-blocking mode when it's a terminal. This fix must be backported to 1.9.
This commit is contained in:
parent
4afdd13842
commit
b1d7b700bb
@ -1378,8 +1378,11 @@ void __send_log(struct proxy *p, int level, char *message, size_t size, char *sd
|
|||||||
/* the socket's address is a file descriptor */
|
/* the socket's address is a file descriptor */
|
||||||
plogfd = (int *)&((struct sockaddr_in *)&logsrv->addr)->sin_addr.s_addr;
|
plogfd = (int *)&((struct sockaddr_in *)&logsrv->addr)->sin_addr.s_addr;
|
||||||
if (unlikely(!((struct sockaddr_in *)&logsrv->addr)->sin_port)) {
|
if (unlikely(!((struct sockaddr_in *)&logsrv->addr)->sin_port)) {
|
||||||
/* FD not yet initialized to non-blocking mode */
|
/* FD not yet initialized to non-blocking mode.
|
||||||
fcntl(*plogfd, F_SETFL, O_NONBLOCK);
|
* DON'T DO IT ON A TERMINAL!
|
||||||
|
*/
|
||||||
|
if (!isatty(*plogfd))
|
||||||
|
fcntl(*plogfd, F_SETFL, O_NONBLOCK);
|
||||||
((struct sockaddr_in *)&logsrv->addr)->sin_port = 1;
|
((struct sockaddr_in *)&logsrv->addr)->sin_port = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user