diff --git a/cronie-1.2-reload.patch b/cronie-1.2-reload.patch deleted file mode 100644 index 1cfb12a..0000000 --- a/cronie-1.2-reload.patch +++ /dev/null @@ -1,232 +0,0 @@ -diff -up cronie-1.2/src/database.c.reload cronie-1.2/src/database.c ---- cronie-1.2/src/database.c.reload 2008-12-19 11:34:04.000000000 +0100 -+++ cronie-1.2/src/database.c 2008-12-22 14:22:30.000000000 +0100 -@@ -153,7 +153,7 @@ process_crontab(const char *uname, const - - #if defined WITH_INOTIFY - void --check_inotify_database(cron_db *old_db, int fd) { -+check_inotify_database(cron_db *old_db) { - cron_db new_db; - DIR_T *dp; - DIR *dir; -@@ -167,17 +167,18 @@ check_inotify_database(cron_db *old_db, - time.tv_usec = 0; - - FD_ZERO(&rfds); -- FD_SET(fd, &rfds); -+ FD_SET(old_db->ifd, &rfds); - -- retval = select(fd + 1, &rfds, NULL, NULL, &time); -+ retval = select(old_db->ifd + 1, &rfds, NULL, NULL, &time); - if (retval == -1) { - if (errno != EINTR) - log_it("CRON", pid, "INOTIFY", "select failed", errno); - return; - } -- else if (FD_ISSET(fd, &rfds)) { -+ else if (FD_ISSET(old_db->ifd, &rfds)) { - new_db.head = new_db.tail = NULL; -- while ((retval=read(fd, buf, sizeof(buf))) == -1 && errno == EINTR); -+ new_db.ifd = old_db->ifd; -+ while ((retval=read(old_db->ifd, buf, sizeof(buf))) == -1 && errno == EINTR); - - if (retval == 0) { - /* this should not happen as the buffer is large enough */ -@@ -195,7 +196,7 @@ check_inotify_database(cron_db *old_db, - /* we must reinstate the watches here - TODO reinstate only watches - * which get IN_IGNORED event - */ -- set_cron_watched(fd); -+ set_cron_watched(old_db->ifd); - - /* TODO: parse the events and read only affected files */ - -@@ -269,7 +270,7 @@ overwrite_database(cron_db *old_db, cron - *old_db = *new_db; - } - --void -+int - load_database(cron_db *old_db) { - struct stat statbuf, syscron_stat, crond_stat; - cron_db new_db; -@@ -318,7 +319,7 @@ load_database(cron_db *old_db) { - ){ - Debug(DLOAD, ("[%ld] spool dir mtime unch, no load needed.\n", - (long)pid)) -- return; -+ return 0; - } - - /* something's different. make a new database, moving unchanged -@@ -329,6 +330,9 @@ load_database(cron_db *old_db) { - new_db.mtime = TMAX(crond_stat.st_mtime, - TMAX(statbuf.st_mtime, syscron_stat.st_mtime)); - new_db.head = new_db.tail = NULL; -+#if defined WITH_INOTIFY -+ new_db.ifd = old_db->ifd; -+#endif - - if (syscron_stat.st_mtime) - process_crontab("root", NULL, SYSCRONTAB, &new_db, old_db); -@@ -382,6 +386,7 @@ load_database(cron_db *old_db) { - - overwrite_database(old_db, &new_db); - Debug(DLOAD, ("load_database is done\n")) -+ return 1; - } - - void -diff -up cronie-1.2/src/funcs.h.reload cronie-1.2/src/funcs.h ---- cronie-1.2/src/funcs.h.reload 2008-06-26 14:56:00.000000000 +0200 -+++ cronie-1.2/src/funcs.h 2008-12-22 12:12:30.000000000 +0100 -@@ -41,14 +41,13 @@ void set_cron_uid(void), - log_it(const char *, PID_T, const char *, const char *, int), - log_close(void); - #if defined WITH_INOTIFY --void load_inotify_database(cron_db *, int ), -- set_cron_watched(int ), -+void set_cron_watched(int ), - set_cron_unwatched(int ), -- check_inotify_database(cron_db *, int ); -+ check_inotify_database(cron_db *); - #endif --void load_database(cron_db *); - --int job_runqueue(void), -+int load_database(cron_db *), -+ job_runqueue(void), - set_debug_flags(const char *), - get_char(FILE *), - get_string(char *, int, FILE *, char *), -diff -up cronie-1.2/src/structs.h.reload cronie-1.2/src/structs.h ---- cronie-1.2/src/structs.h.reload 2008-06-26 14:56:00.000000000 +0200 -+++ cronie-1.2/src/structs.h 2008-12-22 12:06:04.000000000 +0100 -@@ -60,6 +60,9 @@ typedef struct _user { - typedef struct _cron_db { - user *head, *tail; /* links */ - time_t mtime; /* last modtime on spooldir */ -+#ifdef WITH_INOTIFY -+ int ifd; -+#endif - } cron_db; - /* in the C tradition, we only create - * variables for the main program, just -diff -up cronie-1.2/src/cron.c.reload cronie-1.2/src/cron.c ---- cronie-1.2/src/cron.c.reload 2008-06-26 14:56:00.000000000 +0200 -+++ cronie-1.2/src/cron.c 2008-12-22 14:38:13.000000000 +0100 -@@ -79,7 +79,8 @@ set_cron_watched(int fd) { - int w; - - w = inotify_add_watch(fd, watchpaths[i], -- IN_CLOSE_WRITE | IN_ATTRIB | IN_MOVED_TO | IN_MOVED_FROM | IN_MOVE_SELF | IN_DELETE); -+ IN_CREATE | IN_CLOSE_WRITE | IN_ATTRIB | IN_MODIFY | IN_MOVED_TO | -+ IN_MOVED_FROM | IN_MOVE_SELF | IN_DELETE | IN_DELETE_SELF); - if (w < 0) { - if (wd[i] != -1) { - log_it("CRON", pid, "This directory or file can't be watched", watchpaths[i], errno); -@@ -101,6 +102,27 @@ set_cron_watched(int fd) { - #endif - - static void -+handle_signals(cron_db *database) { -+ if (got_sighup) { -+ got_sighup = 0; -+#if defined WITH_INOTIFY -+ /* watches must be reinstated on reload */ -+ if (inotify_enabled) { -+ set_cron_unwatched(database->ifd); -+ inotify_enabled = 0; -+ } -+#endif -+ database->mtime = (time_t) 0; -+ log_close(); -+ } -+ -+ if (got_sigchld) { -+ got_sigchld = 0; -+ sigchld_reaper(); -+ } -+} -+ -+static void - usage(void) { - const char **dflags; - -@@ -216,7 +238,7 @@ main(int argc, char *argv[]) { - wd[i] = -2; - } - -- fd = inotify_init(); -+ database.ifd = fd = inotify_init(); - if (fd < 0) - log_it("CRON", pid, "INFO", "Inotify init failed", errno); - set_cron_watched(fd); -@@ -252,19 +274,19 @@ main(int argc, char *argv[]) { - * clock. Classify the change into one of 4 cases. - */ - timeDiff = timeRunning - virtualTime; -- if (inotify_enabled) { - #if defined WITH_INOTIFY -- check_inotify_database(&database, fd); --#endif -+ if (inotify_enabled) { -+ check_inotify_database(&database); - } - else { -- load_database(&database); --#if defined WITH_INOTIFY -- /* try reinstating the watches */ -- set_cron_watched(fd); --#endif -+ if(load_database(&database)) -+ /* try reinstating the watches */ -+ set_cron_watched(fd); - } -- -+#else -+ load_database(&database); -+#endif -+ - /* shortcut for the most common case */ - if (timeDiff == 1) { - virtualTime = timeRunning; -@@ -354,17 +376,7 @@ main(int argc, char *argv[]) { - /* Jobs to be run (if any) are loaded; clear the queue. */ - job_runqueue(); - -- /* Check to see if we received a signal while running jobs. */ -- if (got_sighup) { -- got_sighup = 0; -- if (!inotify_enabled) -- database.mtime = (time_t) 0; -- log_close(); -- } -- if (got_sigchld) { -- got_sigchld = 0; -- sigchld_reaper(); -- } -+ handle_signals(&database); - } - - #if defined WITH_INOTIFY -@@ -502,16 +514,8 @@ cron_sleep(int target, cron_db *db) { - * If so, service the signal(s) then continue sleeping - * where we left off. - */ -- if (got_sighup) { -- got_sighup = 0; -- if (!inotify_enabled) -- db->mtime = (time_t) 0; -- log_close(); -- } -- if (got_sigchld) { -- got_sigchld = 0; -- sigchld_reaper(); -- } -+ handle_signals(db); -+ - t2 = time(NULL) + GMToff; - seconds_to_wait -= (int)(t2 - t1); - t1 = t2; diff --git a/cronie.spec b/cronie.spec index 8adae8d..7eb2af3 100644 --- a/cronie.spec +++ b/cronie.spec @@ -6,11 +6,12 @@ Summary: Cron daemon for executing programs at set times Name: cronie Version: 1.3 -Release: 1%{?dist} +Release: 2%{?dist} License: MIT and BSD Group: System Environment/Base URL: https://fedorahosted.org/cronie Source0: https://fedorahosted.org/releases/c/r/cronie/%{name}-%{version}.tar.gz +Patch0: reboot-alias-check-the-return-value.patch #Source0: http://mmaslano.fedorapeople.org/cronie/%{name}-%{version}.tar.gz Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) @@ -47,6 +48,7 @@ SELinux. %prep %setup -q +%patch0 -p1 %build @@ -63,8 +65,7 @@ SELinux. %if %{with inotify} --with-inotify %endif - -make %{?_smp_mflags} +make %{?_smp_mflags} %install rm -rf $RPM_BUILD_ROOT @@ -126,6 +127,9 @@ cp -a /var/lock/subsys/crond /var/lock/subsys/cronie > /dev/null 2>&1 ||: %config(noreplace) %{_sysconfdir}/cron.deny %changelog +* Thu Jun 18 2009 Marcela Mašláňová - 1.3-2 +- 506560 check return value of access + * Mon Apr 27 2009 Marcela Mašláňová - 1.3-1 - new release diff --git a/init.patch b/init.patch deleted file mode 100644 index 13845f8..0000000 --- a/init.patch +++ /dev/null @@ -1,189 +0,0 @@ -diff -up cronie-1.2/cronie.init.old cronie-1.2/cronie.init ---- cronie-1.2/cronie.init.old 2008-06-26 14:56:00.000000000 +0200 -+++ cronie-1.2/cronie.init 2008-10-24 14:46:59.000000000 +0200 -@@ -1,4 +1,4 @@ --#! /bin/bash -+#!/bin/sh - # - # crond Start/Stop the cron clock daemon. - # -@@ -7,9 +7,19 @@ - # programs at periodic scheduled times. vixie cron adds a \ - # number of features to the basic UNIX cron, including better \ - # security and more powerful configuration options. --# processname: crond --# config: /etc/crontab --# pidfile: /var/run/crond.pid -+ -+### BEGIN INIT INFO -+# Provides: crond crontab -+# Required-Start: $local_fs $syslog -+# Required-Stop: $local_fs $syslog -+# Default-Start: 2345 -+# Default-Stop: 90 -+# Short-Description: run cron daemon -+# Description: cron is a standard UNIX program that runs user-specified -+# programs at periodic scheduled times. vixie cron adds a -+# number of features to the basic UNIX cron, including better -+# security and more powerful configuration options. -+### END INIT INFO - - [ -f /etc/sysconfig/crond ] || { - [ "$1" = "status" ] && exit 4 || exit 6 -@@ -17,82 +27,104 @@ - - RETVAL=0 - prog="crond" --CROND=/usr/sbin/crond --LOCK_FILE=/var/lock/subsys/crond -+exec=/usr/sbin/crond -+lockfile=/var/lock/subsys/crond -+config=/etc/sysconfig/crond - - # Source function library. --. /etc/init.d/functions -+. /etc/rc.d/init.d/functions - --# set sysconfig settings --[ -f /etc/sysconfig/crond ] && . /etc/sysconfig/crond -+[ -e /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog - - # validate mail - t=${CRON_VALIDATE_MAILRCPTS:-UNSET} - [ "$t" != "UNSET" ] && export CRON_VALIDATE_MAILRCPTS="$t" -- --prog="crond" - - start() { -- echo -n $"Starting $prog: " -- daemon $prog $CRONDARGS && success || failure -- RETVAL=$? -- [ "$RETVAL" = 0 ] && touch $LOCK_FILE -- echo -+ [ -x $exec ] || exit 5 -+ [ -f $config ] || exit 6 -+ echo -n $"Starting $prog: " -+ daemon $prog $CRONDARGS && success || failure -+ retval=$? -+ echo -+ [ $retval -eq 0 ] && touch $lockfile -+ return $retval - } - - stop() { -- echo -n $"Stopping $prog: " -- if [ -n "`pidfileofproc $CROND`" ]; then -- killproc $CROND -+ echo -n $"Stopping $prog: " -+ if [ -n "`pidfileofproc $exec`" ]; then -+ killproc $exec - RETVAL=3 - else - failure $"Stopping $prog" - fi -- RETVAL=$? -- [ "$RETVAL" = 0 ] && rm -f $LOCK_FILE -- echo --} -+ retval=$? -+ echo -+ [ $retval -eq 0 ] && rm -f $lockfile -+ return $retval -+} -+ -+restart() { -+ stop -+ start -+} - - reload() { - echo -n $"Reloading $prog: " -- if [ -n "`pidfileofproc $CROND`" ]; then -- killproc $CROND -HUP -+ if [ -n "`pidfileofproc $exec`" ]; then -+ killproc $exec -HUP - else - failure $"Reloading $prog" - fi -- RETVAL=$? -+ retval=$? - echo --} -+} -+ -+force_reload() { -+ # new configuration takes effect after restart -+ restart -+} -+ -+rh_status() { -+ # run checks to determine if the service is running or use generic status -+ status $prog -+} -+ -+rh_status_q() { -+ rh_status >/dev/null 2>&1 -+} -+ - - case "$1" in -- start) -- start -- ;; -- stop) -- stop -- ;; -- restart) -- stop -- start -- ;; -- reload) -- reload -- ;; -- status) -- status $CROND -- ;; -- condrestart) -- if [ -f $LOCK_FILE ]; then -- if [ "$RETVAL" = 0 ]; then -- stop -- sleep 3 -- start -- fi -- fi -- ;; -- *) -- echo $"Usage: $0 {start|stop|status|reload|restart|condrestart}" -- RETVAL=3 -+ start) -+ rh_status_q && exit 0 -+ $1 -+ ;; -+ stop) -+ rh_status_q || exit 0 -+ $1 -+ ;; -+ restart) -+ $1 -+ ;; -+ reload) -+ rh_status_q || exit 7 -+ $1 -+ ;; -+ force-reload) -+ force_reload -+ ;; -+ status) -+ rh_status -+ ;; -+ condrestart|try-restart) -+ rh_status_q || exit 0 -+ restart -+ ;; -+ *) -+ echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}" -+ exit 2 - esac --exit $RETVAL -+exit $? - diff --git a/nofollow.patch b/nofollow.patch deleted file mode 100644 index ff8a622..0000000 --- a/nofollow.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -up cronie-1.2/src/database.c.old cronie-1.2/src/database.c ---- cronie-1.2/src/database.c.old 2008-06-26 14:56:00.000000000 +0200 -+++ cronie-1.2/src/database.c 2008-12-19 12:21:15.000000000 +0100 -@@ -51,7 +51,7 @@ check_open(const char *tabname, const ch - int crontab_fd; - pid_t pid = getpid(); - -- if ((crontab_fd = open(tabname, O_RDONLY|O_NONBLOCK|O_NOFOLLOW, 0)) == -1) { -+ if ((crontab_fd = open(tabname, O_RDONLY|O_NONBLOCK, 0)) == -1) { - log_it(uname, pid, "CAN'T OPEN", tabname, errno); - return(-1); - } diff --git a/reboot-alias-check-the-return-value.patch b/reboot-alias-check-the-return-value.patch new file mode 100644 index 0000000..6773101 --- /dev/null +++ b/reboot-alias-check-the-return-value.patch @@ -0,0 +1,12 @@ +diff -up cronie-1.3/src/cron.c.old cronie-1.3/src/cron.c +--- cronie-1.3/src/cron.c.old 2009-05-22 08:16:34.000000000 +0200 ++++ cronie-1.3/src/cron.c 2009-06-18 13:38:53.375571259 +0200 +@@ -399,7 +399,7 @@ run_reboot_jobs(cron_db *db) { + pid_t pid = getpid(); + + /* lock exist - skip reboot jobs */ +- if (access(REBOOT_LOCK, F_OK)) { ++ if (access(REBOOT_LOCK, F_OK) == 0) { + log_it("CRON", pid, "INFO", "@reboot jobs will be run at computer's startup.", 0); + return; + }