diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2004-05-03 15:10:22 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2004-05-03 15:10:22 +0000 |
commit | 19b5abc74c55fac31766f7e5c5a906086aa315af (patch) | |
tree | 54d913b155f893a8f54a74f440022d14d88b14be /usr.sbin/cron | |
parent | d46ecd91acdfcbc2b146f9cd3f9f1662054a4c43 (diff) |
Make socket that reads reload requests from crontab be non-blocking.
Problem found by Jarno Huuskonen.
Diffstat (limited to 'usr.sbin/cron')
-rw-r--r-- | usr.sbin/cron/cron.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/usr.sbin/cron/cron.c b/usr.sbin/cron/cron.c index 6e153ba756b..22bc0318438 100644 --- a/usr.sbin/cron/cron.c +++ b/usr.sbin/cron/cron.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cron.c,v 1.32 2003/03/10 15:27:17 millert Exp $ */ +/* $OpenBSD: cron.c,v 1.33 2004/05/03 15:10:21 millert Exp $ */ /* Copyright 1988,1990,1993,1994 by Paul Vixie * All rights reserved @@ -22,7 +22,7 @@ */ #if !defined(lint) && !defined(LINT) -static const char rcsid[] = "$OpenBSD: cron.c,v 1.32 2003/03/10 15:27:17 millert Exp $"; +static const char rcsid[] = "$OpenBSD: cron.c,v 1.33 2004/05/03 15:10:21 millert Exp $"; #endif #define MAIN_PROGRAM @@ -406,7 +406,7 @@ cron_sleep(int target) { Debug(DSCH, ("[%ld] Got a poke on the socket\n", (long)getpid())) fd = accept(cronSock, (struct sockaddr *)&s_un, &sunlen); - if (fd >= 0) { + if (fd >= 0 && fcntl(fd, F_SETFL, O_NONBLOCK) == 0) { (void) read(fd, &poke, 1); close(fd); if (poke & RELOAD_CRON) |