at/at-3.2.5-aborted-jobs.patch

23 lines
798 B
Diff
Raw Normal View History

diff -ur b/atd.c a/atd.c
--- b/atd.c 2022-02-22 15:55:28.745663105 +0100
+++ a/atd.c 2022-02-22 16:07:26.416578085 +0100
@@ -722,12 +722,18 @@
/* Is the file already locked?
*/
if (buf.st_nlink > 1) {
+ if (run_time < buf.st_mtime)
+ run_time = buf.st_mtime;
if (run_time + CHECK_INTERVAL <= now) {
/* Something went wrong the last time this was executed.
* Let's remove the lockfile and reschedule.
+ * We also change the timestamp to avoid rerunning the job more
+ * than once every CHECK_INTERVAL.
*/
strncpy(lock_name, dirent->d_name, sizeof(lock_name));
+ if (utime(lock_name, 0) < 0)
+ syslog(LOG_ERR, "utime couldn't be set for lock file %s\n", lock_name);
lock_name[sizeof(lock_name)-1] = '\0';
lock_name[0] = '=';
unlink(lock_name);