From: Marcela Mašláňová Date: Tue, 19 Jun 2012 11:31:16 +0000 (+0200) Subject: syscrontab, the system crontab, is not mandatory anymore. X-Git-Tag: cronie1.4.9~9 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2d87a431498dcb18c94f8f1ab61d6e43bef1f8df;p=cronie syscrontab, the system crontab, is not mandatory anymore. Cronie can be build without it. The patch was based on complaints of distribution without /etc/crontab file. https://fedorahosted.org/cronie/ticket/10 --- diff --git a/configure.ac b/configure.ac index ae76299..7f0303e 100644 --- a/configure.ac +++ b/configure.ac @@ -212,6 +212,13 @@ AC_ARG_WITH(audit, fi ] ) +AC_ARG_WITH(syscrontab, + [AS_HELP_STRING([--with-syscrontab], [Build cronie with syscrontab enabled.])], + [ if test "x$withval" != xno; then + AC_DEFINE(WITH_SYSCRONTAB,1,[Define if you want syscrontab.]) + fi ] +) + dnl CRONIE_VAR_DEFAULT (VAR, DESCRIPTION, DEFAULT) dnl -------------------------------------------- AC_DEFUN([CRONIE_CONF_VAR], diff --git a/src/cron.c b/src/cron.c index f0fa725..ee1d2a8 100644 --- a/src/cron.c +++ b/src/cron.c @@ -59,10 +59,16 @@ static int DisableInotify; * clustering enabled. */ -# define NUM_WATCHES 3 +# if defined WITH_SYSCRONTAB +# define NUM_WATCHES 3 int wd[NUM_WATCHES]; const char *watchpaths[NUM_WATCHES] = {SPOOL_DIR, SYS_CROND_DIR, SYSCRONTAB}; +# else +# define NUM_WATCHES 2 +int wd[NUM_WATCHES]; +const char *watchpaths[NUM_WATCHES] = {SPOOL_DIR, SYS_CROND_DIR}; +# endif static void reset_watches(void) { int i; diff --git a/src/database.c b/src/database.c index b0f2254..0545913 100644 --- a/src/database.c +++ b/src/database.c @@ -321,8 +321,9 @@ void check_inotify_database(cron_db * old_db) { set_cron_watched(old_db->ifd); /* TODO: parse the events and read only affected files */ - +#if defined WITH_SYSCRONTAB process_crontab("root", NULL, SYSCRONTAB, &new_db, old_db); +#endif if (!(dir = opendir(SYS_CROND_DIR))) { log_it("CRON", pid, "OPENDIR FAILED", SYS_CROND_DIR, errno); @@ -429,10 +430,12 @@ int load_database(cron_db * old_db) { max_mtime(SYS_CROND_DIR, &crond_stat); } +#if defined WITH_SYSCRONTAB /* track system crontab file */ if (stat(SYSCRONTAB, &syscron_stat) < OK) syscron_stat.st_mtime = 0; +#endif /* if spooldir's mtime has not changed, we don't need to fiddle with * the database. @@ -461,8 +464,10 @@ int load_database(cron_db * old_db) { new_db.ifd = old_db->ifd; #endif +#if defined WITH_SYSCRONTAB if (syscron_stat.st_mtime) process_crontab("root", NULL, SYSCRONTAB, &new_db, old_db); +#endif if (!(dir = opendir(SYS_CROND_DIR))) { log_it("CRON", pid, "OPENDIR FAILED", SYS_CROND_DIR, errno);