improve the wrong_format patch, also rename it to correct name

This commit is contained in:
Tomas Mraz 2017-09-14 15:54:13 +02:00
parent f2ac390859
commit 5dfacd58d8
2 changed files with 15 additions and 13 deletions

View File

@ -1,23 +1,22 @@
diff -up at-3.1.14/atd.c.seg at-3.1.14/atd.c
--- at-3.1.14/atd.c.seg 2013-12-02 14:33:48.650769756 +0100
+++ at-3.1.14/atd.c 2013-12-02 14:52:49.057437721 +0100
@@ -752,14 +752,17 @@ run_loop()
diff -up at-3.1.20/atd.c.aborted at-3.1.20/atd.c
--- at-3.1.20/atd.c.aborted 2017-09-14 15:31:47.971486148 +0200
+++ at-3.1.20/atd.c 2017-09-14 15:43:53.506567281 +0200
@@ -731,12 +731,17 @@ run_loop()
/* Is the file already locked?
*/
if (buf.st_nlink > 1) {
- if (run_time + CHECK_INTERVAL <= now) {
+ if (run_time < buf.st_mtime)
+ run_time = buf.st_mtime;
if (run_time + CHECK_INTERVAL <= now) {
-
+ if (buf.st_mtime + 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));
lock_name[sizeof(lock_name)-1] = '\0';
lock_name[0] = '=';
+ 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);
next_job = now;
nothing_to_do = 0;

View File

@ -3,7 +3,7 @@
Summary: Job spooling tools
Name: at
Version: 3.1.20
Release: 7%{?dist}
Release: 8%{?dist}
# http://packages.debian.org/changelogs/pool/main/a/at/current/copyright
# + install-sh is MIT license with changes under Public Domain
License: GPLv3+ and GPLv2+ and ISC and MIT and Public Domain
@ -25,7 +25,7 @@ Patch6: at-3.1.18-nitpicks.patch
Patch8: at-3.1.14-fix_no_export.patch
Patch9: at-3.1.14-mailwithhostname.patch
Patch10: at-3.1.14-usePOSIXtimers.patch
Patch12: at-3.1.14-wrong_format.patch
Patch12: at-3.1.20-aborted-jobs.patch
Patch13: at-3.1.18-noabort.patch
Patch14: at-3.1.16-fclose-error.patch
Patch15: at-3.1.16-clear-nonjobs.patch
@ -76,7 +76,7 @@ cp %{SOURCE1} .
%patch8 -p1 -b .export
%patch9 -p1 -b .mail
%patch10 -p1 -b .posix
%patch12 -p1 -b .wrong
%patch12 -p1 -b .aborted
%patch13 -p1 -b .noabort
%patch14 -p1 -b .fclose
%patch15 -p1 -b .clear-nojobs
@ -181,6 +181,9 @@ chown root:root %{_localstatedir}/spool/at/.SEQ
%attr(0644,root,root) /%{_unitdir}/atd.service
%changelog
* Thu Sep 14 2017 Tomáš Mráz <tmraz@redhat.com> - 3.1.20-8
- improve the wrong_format patch, also rename it to correct name
* Thu Sep 14 2017 Tomáš Mráz <tmraz@redhat.com> - 3.1.20-7
- the ownership of the spool directory should be root as at is configured
with daemon username root