From 2d3a872e9c66d9550a5b3cc97fa78ff9d7708cce Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marcela=20Ma=C5=A1l=C3=A1=C5=88ov=C3=A1?= Date: Fri, 8 Oct 2010 12:17:15 +0200 Subject: [PATCH] Check clustering before un/watch function --- src/cron.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/cron.c b/src/cron.c index d7cc9e0..eb4a0c8 100644 --- a/src/cron.c +++ b/src/cron.c @@ -67,9 +67,6 @@ const char *watchpaths[NUM_WATCHES] = {SPOOL_DIR, SYS_CROND_DIR, SYSCRONTAB}; void set_cron_unwatched(int fd) { int i; - if (EnableClustering) - return; - for (i = 0; i < sizeof (wd) / sizeof (wd[0]); ++i) { if (wd[i] < 0) { inotify_rm_watch(fd, wd[i]); @@ -82,7 +79,7 @@ void set_cron_watched(int fd) { pid_t pid = getpid(); int i; - if (fd < 0 || EnableClustering) { + if (fd < 0) { inotify_enabled = 0; return; } @@ -120,7 +117,7 @@ static void handle_signals(cron_db * database) { got_sighup = 0; #if defined WITH_INOTIFY /* watches must be reinstated on reload */ - if (inotify_enabled) { + if (inotify_enabled && (EnableClustering != 1)) { set_cron_unwatched(database->ifd); inotify_enabled = 0; } @@ -312,7 +309,7 @@ int main(int argc, char *argv[]) { check_inotify_database(&database); } else { - if (load_database(&database)) + if (load_database(&database) && EnableClustering) /* try reinstating the watches */ set_cron_watched(fd); } @@ -410,7 +407,7 @@ int main(int argc, char *argv[]) { } #if defined WITH_INOTIFY - if (inotify_enabled) + if (inotify_enabled && (EnableClustering != 1)) set_cron_unwatched(fd); if (fd >= 0 && close(fd) < 0) @@ -631,7 +628,7 @@ static void parse_args(int argc, char *argv[]) { strncpy(MailCmd, optarg, MAX_COMMAND); break; case 'c': - EnableClustering = 1; + EnableClustering = 1; break; case 'h': default: -- 2.40.0