summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libc/misc/syslog/syslog.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/libc/misc/syslog/syslog.c b/libc/misc/syslog/syslog.c
index 72afabb83..1df0d1ae3 100644
--- a/libc/misc/syslog/syslog.c
+++ b/libc/misc/syslog/syslog.c
@@ -126,6 +126,7 @@ openlog_intern(void)
{
int fd;
int logType = SOCK_DGRAM;
+ static const struct timeval tv = { 1, 0 };
fd = LogFile;
if (fd == -1) {
@@ -143,6 +144,9 @@ openlog_intern(void)
if (fd != -1 && !connected) {
if (connect(fd, &SyslogAddr, sizeof(SyslogAddr)) != -1) {
+ /* We want to block send if e.g. syslogd is SIGSTOPed */
+ fcntl(fd, F_SETFL, ~O_NONBLOCK & fcntl(fd, F_GETFL));
+ setsockopt(fd, SOL_SOCKET, SO_SNDTIMEO, &tv, sizeof(tv));
connected = 1;
} else {
if (fd != -1) {