vec++;
}
+ if (unlikely(!fdtab[fd].initialized)) {
+ fdtab[fd].initialized = 1;
+ if (!isatty(fd))
+ fcntl(fd, F_SETFL, O_NONBLOCK);
+ }
+
HA_SPIN_LOCK(FD_LOCK, &fdtab[fd].lock);
sent = writev(fd, iovec, vec);
HA_SPIN_UNLOCK(FD_LOCK, &fdtab[fd].lock);
if (logsrv->addr.ss_family == AF_UNSPEC) {
/* the socket's address is a file descriptor */
plogfd = (int *)&((struct sockaddr_in *)&logsrv->addr)->sin_addr.s_addr;
- if (unlikely(!((struct sockaddr_in *)&logsrv->addr)->sin_port)) {
+ if (!fdtab[*plogfd].initialized) {
/* FD not yet initialized to non-blocking mode.
* DON'T DO IT ON A TERMINAL!
*/
+ fdtab[*plogfd].initialized = 1;
if (!isatty(*plogfd))
fcntl(*plogfd, F_SETFL, O_NONBLOCK);
- ((struct sockaddr_in *)&logsrv->addr)->sin_port = 1;
}
}
else if (logsrv->addr.ss_family == AF_UNIX)
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include <fcntl.h>
-#include <unistd.h>
#include <common/compat.h>
#include <common/config.h>
#include <common/ist.h>
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->ctx.fd = fd;
end: