提交 a77411a5 编写于 作者: R Rich Felker

remove useless SIGPIPE protection from syslog

per the standard, SIGPIPE is not generated for SOCK_DGRAM.
上级 a444ee34
...@@ -65,7 +65,6 @@ void openlog(const char *ident, int opt, int facility) ...@@ -65,7 +65,6 @@ void openlog(const char *ident, int opt, int facility)
void syslog(int priority, const char *message, ...) void syslog(int priority, const char *message, ...)
{ {
sigset_t set, oldset;
va_list ap; va_list ap;
char timebuf[16]; char timebuf[16];
time_t now; time_t now;
...@@ -83,10 +82,6 @@ void syslog(int priority, const char *message, ...) ...@@ -83,10 +82,6 @@ void syslog(int priority, const char *message, ...)
return; return;
} }
sigemptyset(&set);
sigaddset(&set, SIGPIPE);
pthread_sigmask(SIG_BLOCK, &set, &oldset);
now = time(NULL); now = time(NULL);
gmtime_r(&now, &tm); gmtime_r(&now, &tm);
strftime(timebuf, sizeof timebuf, "%b %e %T", &tm); strftime(timebuf, sizeof timebuf, "%b %e %T", &tm);
...@@ -105,9 +100,5 @@ void syslog(int priority, const char *message, ...) ...@@ -105,9 +100,5 @@ void syslog(int priority, const char *message, ...)
// Note: LOG_CONS is not supported because it is annoying!! // Note: LOG_CONS is not supported because it is annoying!!
// syslogd will send messages to console if it deems them appropriate! // syslogd will send messages to console if it deems them appropriate!
/* Clear any possible SIGPIPE generated by the socket write. */
sigtimedwait(&set, 0, (struct timespec [1]){0}) || (perror("x"),1);
pthread_sigmask(SIG_SETMASK, &oldset, 0);
UNLOCK(&lock); UNLOCK(&lock);
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册