mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-22 14:21:25 +02:00
MINOR: sink: set the fd-type sinks to non-blocking
Just like we used to do for the logs, we must disable blocking on FD output except if it's a terminal.
This commit is contained in:
parent
177adc9e57
commit
799e9ed62b
@ -19,6 +19,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/uio.h>
|
#include <sys/uio.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <unistd.h>
|
||||||
#include <common/compat.h>
|
#include <common/compat.h>
|
||||||
#include <common/config.h>
|
#include <common/config.h>
|
||||||
#include <common/ist.h>
|
#include <common/ist.h>
|
||||||
@ -89,6 +91,11 @@ struct sink *sink_new_fd(const char *name, const char *desc, enum sink_fmt fmt,
|
|||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* FD not yet initialized to non-blocking mode.
|
||||||
|
* DON'T DO IT ON A TERMINAL!
|
||||||
|
*/
|
||||||
|
if (!isatty(fd))
|
||||||
|
fcntl(fd, F_SETFL, O_NONBLOCK);
|
||||||
sink->type = SINK_TYPE_FD;
|
sink->type = SINK_TYPE_FD;
|
||||||
sink->ctx.fd = fd;
|
sink->ctx.fd = fd;
|
||||||
end:
|
end:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user