From 5cadb0d4d0b7114372ce2c771f03c5a43f4ce10b Mon Sep 17 00:00:00 2001 From: Theo de Raadt Date: Tue, 3 Feb 1998 19:08:00 +0000 Subject: workaround gethostbyaddr() race in signal handler; more correct fix would change SIGHUP handler to only set a flag that the main loop catches. But I'm lazy, and starting to believe noone gives a damn... --- usr.sbin/syslogd/syslogd.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'usr.sbin') diff --git a/usr.sbin/syslogd/syslogd.c b/usr.sbin/syslogd/syslogd.c index 4735b07c0f7..33cc524752e 100644 --- a/usr.sbin/syslogd/syslogd.c +++ b/usr.sbin/syslogd/syslogd.c @@ -798,6 +798,7 @@ cvthname(f) struct sockaddr_in *f; { struct hostent *hp; + sigset_t omask, nmask; char *p; dprintf("cvthname(%s)\n", inet_ntoa(f->sin_addr)); @@ -806,8 +807,12 @@ cvthname(f) dprintf("Malformed from address\n"); return ("???"); } + sigemptyset(&nmask); + sigaddset(&nmask, SIGHUP); + sigprocmask(SIG_BLOCK, &nmask, &omask); hp = gethostbyaddr((char *)&f->sin_addr, sizeof(struct in_addr), f->sin_family); + sigprocmask(SIG_SETMASK, &omask, NULL); if (hp == 0) { dprintf("Host name for your address (%s) unknown\n", inet_ntoa(f->sin_addr)); -- cgit v1.2.3