summaryrefslogtreecommitdiff
path: root/usr.sbin/syslogd
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1998-02-03 19:08:00 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1998-02-03 19:08:00 +0000
commit5cadb0d4d0b7114372ce2c771f03c5a43f4ce10b (patch)
treeeac2e52c0c5e4db718f6f5f7fc6abd11c2d72a29 /usr.sbin/syslogd
parent13741186943189817d5028e255b27df409c25741 (diff)
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...
Diffstat (limited to 'usr.sbin/syslogd')
-rw-r--r--usr.sbin/syslogd/syslogd.c5
1 files changed, 5 insertions, 0 deletions
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));