static volatile sig_atomic_t got_sighup, got_sigchld;
static int timeRunning, virtualTime, clockTime;
static long GMToff;
-static int DisableInotify = 0;
+static int DisableInotify;
#if defined WITH_INOTIFY
static void handle_signals(cron_db * database) {
if (got_sighup) {
got_sighup = 0;
- if (DisableInotify)
#if defined WITH_INOTIFY
/* watches must be reinstated on reload */
if (inotify_enabled) {
(void) close(fd);
}
log_it("CRON", getpid(), "STARTUP", PACKAGE_VERSION, 0);
- if (DisableInotify)
- log_it("CRON", getpid(), "Switch off inotify - daemon runs with -i option",
- "", 0);
break;
default:
/* parent process should just die */
load_database(&database);
-
- if (DisableInotify)
+ fd = -1;
#if defined WITH_INOTIFY
- for (i = 0; i < sizeof (wd) / sizeof (wd[0]); ++i) {
- /* initialize to negative number other than -1
- * so an eventual error is reported for the first time
- */
- wd[i] = -2;
+ if (DisableInotify) {
+ log_it("CRON", getpid(), "No inotify - daemon runs with -i option",
+ "", 0);
}
+ else {
+ for (i = 0; i < sizeof (wd) / sizeof (wd[0]); ++i) {
+ /* initialize to negative number other than -1
+ * so an eventual error is reported for the first time
+ */
+ wd[i] = -2;
+ }
- database.ifd = fd = inotify_init();
- fcntl(fd, F_SETFD, FD_CLOEXEC);
- if (fd < 0)
- log_it("CRON", pid, "INFO", "Inotify init failed", errno);
- set_cron_watched(fd);
+ database.ifd = fd = inotify_init();
+ fcntl(fd, F_SETFD, FD_CLOEXEC);
+ if (fd < 0)
+ log_it("CRON", pid, "INFO", "Inotify init failed", errno);
+ set_cron_watched(fd);
+ }
#endif
set_time(TRUE);
* clock. Classify the change into one of 4 cases.
*/
timeDiff = timeRunning - virtualTime;
- if (DisableInotify)
#if defined WITH_INOTIFY
if (inotify_enabled) {
check_inotify_database(&database);
handle_signals(&database);
}
- if (DisableInotify)
#if defined WITH_INOTIFY
if (inotify_enabled)
set_cron_unwatched(fd);
PermitAnyCrontab = 1;
break;
case 'i':
- inotify_enabled = 0;
DisableInotify = 1;
break;
case 'm':