From 876d673618244c4c656232495cc65b8f7f89553d Mon Sep 17 00:00:00 2001 From: Tomas Mraz Date: Thu, 4 May 2017 17:20:52 +0200 Subject: [PATCH] fix Y2038 problems in cron and anacron (#1445136) --- cronie-1.5.1-y2038.patch | 45 ++++++++++++++++++++++++++++++++++++++++ cronie.spec | 7 ++++++- 2 files changed, 51 insertions(+), 1 deletion(-) create mode 100644 cronie-1.5.1-y2038.patch diff --git a/cronie-1.5.1-y2038.patch b/cronie-1.5.1-y2038.patch new file mode 100644 index 0000000..f896ad9 --- /dev/null +++ b/cronie-1.5.1-y2038.patch @@ -0,0 +1,45 @@ +diff -up cronie-1.5.1/anacron/main.c.y2038 cronie-1.5.1/anacron/main.c +--- cronie-1.5.1/anacron/main.c.y2038 2016-05-13 14:39:45.000000000 +0200 ++++ cronie-1.5.1/anacron/main.c 2017-05-04 16:44:06.511862226 +0200 +@@ -371,17 +371,17 @@ record_start_time(void) + year, month, day_of_month); + } + +-static int ++static unsigned int + time_till(job_rec *jr) + /* Return the number of seconds that we have to wait until it's time + * to start job jr. + */ + { +- unsigned int tj, tn; ++ time_t tj, tn; + + if (now) return 0; + tn = time(NULL); +- tj = start_sec + jr->delay * 60; ++ tj = start_sec + (time_t)jr->delay * 60; + if (tj < tn) return 0; + if (tj - tn > 3600*24) + { +@@ -389,7 +389,7 @@ time_till(job_rec *jr) + jr->ident); + return 0; + } +- return tj - tn; ++ return (unsigned int)(tj - tn); + } + + static void +diff -up cronie-1.5.1/src/cron.c.y2038 cronie-1.5.1/src/cron.c +--- cronie-1.5.1/src/cron.c.y2038 2015-02-05 16:29:17.000000000 +0100 ++++ cronie-1.5.1/src/cron.c 2017-05-04 16:41:46.652390903 +0200 +@@ -563,7 +563,7 @@ static void find_jobs(int vtime, cron_db + */ + for (u = db->head; u != NULL; u = u->next) { + for (e = u->crontab; e != NULL; e = e->next) { +- time_t virtualSecond = (vtime - e->delay) * SECONDS_PER_MINUTE; ++ time_t virtualSecond = (time_t)(vtime - e->delay) * (time_t)SECONDS_PER_MINUTE; + time_t virtualGMTSecond = virtualSecond - vGMToff; + job_tz = env_get("CRON_TZ", e->envp); + maketime(job_tz, orig_tz); diff --git a/cronie.spec b/cronie.spec index c0bced7..8036d35 100644 --- a/cronie.spec +++ b/cronie.spec @@ -6,13 +6,14 @@ Summary: Cron daemon for executing programs at set times Name: cronie Version: 1.5.1 -Release: 5%{?dist} +Release: 6%{?dist} License: MIT and BSD and ISC and GPLv2+ Group: System Environment/Base URL: https://fedorahosted.org/cronie Source0: https://fedorahosted.org/releases/c/r/cronie/%{name}-%{version}.tar.gz Patch1: cronie-1.5.1-power.patch +Patch2: cronie-1.5.1-y2038.patch Requires: dailyjobs @@ -78,6 +79,7 @@ extra features. %prep %setup -q %patch1 -p1 -b .power +%patch2 -p1 -b .y2038 %build %configure \ @@ -204,6 +206,9 @@ exit 0 %attr(0644,root,root) %config(noreplace) %{_sysconfdir}/cron.d/dailyjobs %changelog +* Thu May 4 2017 Tomáš Mráz - 1.5.1-6 +- fix Y2038 problems in cron and anacron (#1445136) + * Fri Feb 10 2017 Fedora Release Engineering - 1.5.1-5 - Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild