summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormillert <millert@openbsd.org>2004-05-03 15:10:21 +0000
committermillert <millert@openbsd.org>2004-05-03 15:10:21 +0000
commitc2fb141834eaf253448588e7d504d4a6bf6e9c93 (patch)
treee9d25be59819d75263fccac29e74c952f27b5f7d
parentDo a better job of documenting strerror_r() and add an ERRORS section. (diff)
downloadwireguard-openbsd-c2fb141834eaf253448588e7d504d4a6bf6e9c93.tar.xz
wireguard-openbsd-c2fb141834eaf253448588e7d504d4a6bf6e9c93.zip
Make socket that reads reload requests from crontab be non-blocking.
Problem found by Jarno Huuskonen.
-rw-r--r--usr.sbin/cron/cron.c6
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)