diff --git a/backport-anacron-Use-xclose-instead-of-fclose.patch b/backport-anacron-Use-xclose-instead-of-fclose.patch new file mode 100644 index 0000000..47e67f3 --- /dev/null +++ b/backport-anacron-Use-xclose-instead-of-fclose.patch @@ -0,0 +1,47 @@ +From 880489e42a652b84c7de348f0167dfd26abca326 Mon Sep 17 00:00:00 2001 +From: Tomas Mraz +Date: Fri, 13 Oct 2023 10:40:05 +0200 +Subject: [PATCH] anacron: Use xclose() instead of fclose() + +When replacing standard descriptors we use +xclose() elsewhere and it is less error-prone. + +Fixes #156 +--- + anacron/main.c | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +diff --git a/anacron/main.c b/anacron/main.c +index 65f8fed..1ad904a 100644 +--- a/anacron/main.c ++++ b/anacron/main.c +@@ -209,13 +209,13 @@ go_background(void) + + /* stdin is already closed */ + +- if (fclose(stdout)) die_e("Can't close stdout"); ++ xclose(STDOUT_FILENO); + /* coverity[leaked_handle] – fd 1 closed automatically */ +- xopen(1, "/dev/null", O_WRONLY); ++ xopen(STDOUT_FILENO, "/dev/null", O_WRONLY); + +- if (fclose(stderr)) die_e("Can't close stderr"); ++ xclose(STDERR_FILENO); + /* coverity[leaked_handle] – fd 2 closed automatically */ +- xopen(2, "/dev/null", O_WRONLY); ++ xopen(STDERR_FILENO, "/dev/null", O_WRONLY); + + pid = xfork(); + if (pid != 0) +@@ -476,7 +476,7 @@ main(int argc, char *argv[]) + + if (sigprocmask(0, NULL, &old_sigmask)) die_e("sigset error"); + +- if (fclose(stdin)) die_e("Can't close stdin"); ++ xclose(STDIN_FILENO); + xopen(STDIN_FILENO, "/dev/null", O_RDONLY); + + if (!no_daemon && !testing_only) +-- +2.33.0 + diff --git a/cronie.spec b/cronie.spec index b852597..403bc87 100644 --- a/cronie.spec +++ b/cronie.spec @@ -1,6 +1,6 @@ Name: cronie Version: 1.6.1 -Release: 4 +Release: 5 Summary: Standard UNIX daemon crond License: GPLv2+ and ISC URL: https://github.com/cronie-crond/cronie @@ -10,6 +10,7 @@ Source0: https://github.com/cronie-crond/cronie/releases/download/cronie-%{vers Patch0: bugfix-cronie-systemd-alias.patch Patch6000: backport-Support-reloading-with-SIGURG-in-addition-to-SIGHUP.patch +Patch6001: backport-anacron-Use-xclose-instead-of-fclose.patch BuildRequires: automake BuildRequires: gcc systemd libselinux-devel pam-devel audit-libs-devel @@ -120,6 +121,9 @@ systemctl try-restart crond.service >/dev/null 2>&1 || : %changelog +* Mon Dec 4 2023 hongjinghao - 1.6.1-5 +- anacron use xclose instead of fclose + * Thu Jun 15 2023 wangyuhang - 1.6.1-4 - Type:bugfix - CVE:NA