Two small fixes.

- mark the 0hourly and dailyjobs crontabs as config
- do not add already existing orphan on reload
This commit is contained in:
Tomas Mraz 2015-04-21 15:40:08 +02:00
parent e118cfddd7
commit bb7b26ebbb
2 changed files with 52 additions and 3 deletions

View File

@ -74,6 +74,51 @@ index 901a655..d8b2978 100644
}
}
}
diff -up cronie-1.4.11/src/database.c.refresh-users cronie-1.4.11/src/database.c
--- cronie-1.4.11/src/database.c.refresh-users 2013-07-18 14:27:08.000000000 +0200
+++ cronie-1.4.11/src/database.c 2015-04-21 15:20:03.768846359 +0200
@@ -152,10 +152,41 @@ check_orphans(cron_db *db) {
}
}
+static int
+find_orphan(const char *uname, const char *fname, const char *tabname) {
+ orphan *o;
+
+ for (o = orphans; o != NULL; o = o->next) {
+ if (uname && o->uname) {
+ if (strcmp(uname, o->uname) != 0)
+ continue;
+ } else if (uname != o->uname)
+ continue;
+
+ if (fname && o->fname) {
+ if (strcmp(fname, o->fname) != 0)
+ continue;
+ } else if (fname != o->fname)
+ continue;
+
+ if (tabname && o->tabname) {
+ if (strcmp(tabname, o->tabname) != 0)
+ continue;
+ } else if (tabname != o->tabname)
+ continue;
+ return 1;
+ }
+
+ return 0;
+}
+
static void
add_orphan(const char *uname, const char *fname, const char *tabname) {
orphan *o;
+ if (find_orphan(uname, fname, tabname))
+ return;
+
o = calloc(1, sizeof(*o));
if (o == NULL)
return;
diff --git a/src/entry.c b/src/entry.c
index fa69524..3638207 100644
--- a/src/entry.c

View File

@ -6,7 +6,7 @@
Summary: Cron daemon for executing programs at set times
Name: cronie
Version: 1.4.12
Release: 5%{?dist}
Release: 6%{?dist}
License: MIT and BSD and ISC and GPLv2+
Group: System Environment/Base
URL: https://fedorahosted.org/cronie
@ -187,7 +187,7 @@ exit 0
%endif
%config(noreplace) %{_sysconfdir}/sysconfig/crond
%config(noreplace) %{_sysconfdir}/cron.deny
%attr(0644,root,root) %{_sysconfdir}/cron.d/0hourly
%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/cron.d/0hourly
%attr(0644,root,root) /lib/systemd/system/crond.service
%files anacron
@ -202,9 +202,13 @@ exit 0
%{_mandir}/man8/anacron.*
%files noanacron
%attr(0644,root,root) %{_sysconfdir}/cron.d/dailyjobs
%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/cron.d/dailyjobs
%changelog
* Tue Apr 21 2015 Tomáš Mráz <tmraz@redhat.com> - 1.4.12-6
- mark the 0hourly and dailyjobs crontabs as config
- do not add already existing orphan on reload
* Tue Feb 3 2015 Tomáš Mráz <tmraz@redhat.com> - 1.4.12-5
- correct the permissions of the anacron timestamp files