]> granicus.if.org Git - cronie/commitdiff
Force reload of database when SIGGUP is received.
authormmaslano <mmaslano@redhat.com>
Fri, 17 Aug 2007 13:19:37 +0000 (15:19 +0200)
committerTomas Janousek <tomi@nomi.cz>
Mon, 27 Aug 2007 14:01:43 +0000 (16:01 +0200)
max_mtime uses dir_name instead of SPOOL_DIR now. (which caused a bug
preventing correct detection of changes in RH_CROND_DIR)

(comment updated by <tjanouse@redhat.com>)

cron.c
database.c

diff --git a/cron.c b/cron.c
index 000a5a8ec4b8a954c19207607873662acdfd5713..910d70890cae88bb51a96afa7cf28cee4834e5b6 100644 (file)
--- a/cron.c
+++ b/cron.c
@@ -33,7 +33,7 @@ static        void    usage(void),
                run_reboot_jobs(cron_db *),
                find_jobs(int, cron_db *, int, int),
                set_time(int),
-               cron_sleep(int),
+               cron_sleep(int, cron_db *),
                sigchld_handler(int),
                sighup_handler(int),
                sigchld_reaper(void),
@@ -165,7 +165,7 @@ main(int argc, char *argv[]) {
 
                /* ... wait for the time (in minutes) to change ... */
                do {
-                       cron_sleep(timeRunning + 1);
+                       cron_sleep(timeRunning + 1, &database);
                        set_time(FALSE);
                } while (clockTime == timeRunning);
                timeRunning = clockTime;
@@ -270,6 +270,7 @@ main(int argc, char *argv[]) {
                /* Check to see if we received a signal while running jobs. */
                if (got_sighup) {
                        got_sighup = 0;
+                       database.mtime = (time_t) 0;
                        log_close();
                }
                if (got_sigchld) {
@@ -368,7 +369,7 @@ set_time(int initialize) {
  * Try to just hit the next minute.
  */
 static void
-cron_sleep(int target) {
+cron_sleep(int target, cron_db *db) {
        time_t t1, t2;
        int seconds_to_wait;
 
@@ -387,6 +388,7 @@ cron_sleep(int target) {
                 */
                if (got_sighup) {
                        got_sighup = 0;
+                       db->mtime = (time_t) 0;
                        log_close();
                }
                if (got_sigchld) {
index c8831fc4b1f3fba03fb598fa1a5540f956fcba81..930f19ac89bc06774809f41fce9947df9f2699f9 100644 (file)
@@ -354,7 +354,7 @@ static void max_mtime( char *dir_name, struct stat *max_st )
                if ( not_a_crontab ( dp ) )
                        continue;
 
-               if (!glue_strings(tabname, sizeof tabname, SPOOL_DIR, dp->d_name, '/'))
+               if (!glue_strings(tabname, sizeof tabname, dir_name, dp->d_name, '/'))
                        continue;       /* XXX log? */
 
                if ( stat( tabname, &st ) < OK )