Compare commits

...

10 Commits

Author SHA1 Message Date
openeuler-ci-bot
840de45f56
!32 anacron use xclose instead of fclose
From: @hongjinghao 
Reviewed-by: @licunlong 
Signed-off-by: @licunlong
2023-12-04 11:54:22 +00:00
hongjinghao
cac7bb33ce anacron use xclose instead of fclose 2023-12-04 15:51:09 +08:00
openeuler-ci-bot
2274242964
!30 Support reloading with SIGURG in addition to SIGHUP
From: @wangyuhang27 
Reviewed-by: @licunlong 
Signed-off-by: @licunlong
2023-06-15 06:55:27 +00:00
wangyuhang
4a0de95ad5 Support reloading with SIGURG in addition to SIGHUP 2023-06-15 14:36:04 +08:00
openeuler-ci-bot
cdc60ee231
!24 %check阶段,使用"%make_build check"代替"make check",与22.03分支保持一致
From: @Wangjunqi123 
Reviewed-by: @licunlong 
Signed-off-by: @licunlong
2023-02-15 02:46:15 +00:00
Wangjunqi123
07f574c85e update version to 1 2023-02-15 10:11:37 +08:00
openeuler-ci-bot
098bbe2e53
!22 add version number for Obsoletes
From: @zhangruifang2020 
Reviewed-by: @licunlong 
Signed-off-by: @licunlong
2022-10-18 08:52:37 +00:00
zhangruifang2020
fe60c1fe19 add version number for Obsoletes 2022-10-18 15:26:47 +08:00
openeuler-ci-bot
aa168bff77
!19 Upgrade version to 1.6.1
From: @YukariChiba 
Reviewed-by: @overweight 
Signed-off-by: @overweight
2022-07-25 02:59:48 +00:00
Yukari Chiba
3a9ed577a1 Upgrade version to 1.6.1 2022-07-22 03:51:00 +08:00
5 changed files with 150 additions and 4 deletions

View File

@ -0,0 +1,78 @@
From 630b24112fbd87c0dd020795a221fefc8840630a Mon Sep 17 00:00:00 2001
From: YoruStar <524413304@qq.com>
Date: Wed, 29 Mar 2023 15:58:58 +0800
Subject: [PATCH] Support reloading with SIGURG in addition to SIGHUP
And use that with the systemd unit to handle the reload.
Conflict:NA
Reference:https://github.com/cronie-crond/cronie/commit/630b24112fbd87c0dd020795a221fefc8840630a
---
contrib/cronie.systemd | 2 +-
src/cron.c | 12 ++++++++++--
2 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/contrib/cronie.systemd b/contrib/cronie.systemd
index 19f2a98..8317367 100644
--- a/contrib/cronie.systemd
+++ b/contrib/cronie.systemd
@@ -5,7 +5,7 @@ After=auditd.service nss-user-lookup.target systemd-user-sessions.service time-s
[Service]
EnvironmentFile=/etc/sysconfig/crond
ExecStart=/usr/sbin/crond -n $CRONDARGS
-ExecReload=/bin/kill -HUP $MAINPID
+ExecReload=/bin/kill -URG $MAINPID
KillMode=process
Restart=on-failure
RestartSec=30s
diff --git a/src/cron.c b/src/cron.c
index 1ff19e3..e4e119d 100644
--- a/src/cron.c
+++ b/src/cron.c
@@ -66,10 +66,11 @@ set_time(int),
cron_sleep(int, cron_db *),
sigchld_handler(int),
sighup_handler(int ATTRIBUTE_UNUSED),
+sigurg_handler(int ATTRIBUTE_UNUSED),
sigchld_reaper(void),
sigintterm_handler(int ATTRIBUTE_UNUSED), parse_args(int c, char *v[]);
-static volatile sig_atomic_t got_sighup, got_sigchld, got_sigintterm;
+static volatile sig_atomic_t got_sighup, got_sigchld, got_sigintterm, got_sigurg;
static int timeRunning, virtualTime, clockTime;
static long GMToff;
static int DisableInotify;
@@ -151,8 +152,9 @@ void set_cron_watched(int fd) {
#endif
static void handle_signals(cron_db * database) {
- if (got_sighup) {
+ if (got_sighup || got_sigurg) {
got_sighup = 0;
+ got_sigurg = 0;
#if defined WITH_INOTIFY
/* watches must be reinstated on reload */
if (inotify_enabled && (EnableClustering != 1)) {
@@ -243,6 +245,8 @@ int main(int argc, char *argv[]) {
sact.sa_handler = sigintterm_handler;
(void) sigaction(SIGINT, &sact, NULL);
(void) sigaction(SIGTERM, &sact, NULL);
+ sact.sa_handler = sigurg_handler;
+ (void) sigaction(SIGURG, &sact, NULL);
acquire_daemonlock(0);
set_cron_uid();
@@ -664,6 +668,10 @@ static void sigintterm_handler(int x ATTRIBUTE_UNUSED) {
got_sigintterm = 1;
}
+static void sigurg_handler(int x ATTRIBUTE_UNUSED) {
+ got_sigurg = 1;
+}
+
static void sigchld_reaper(void) {
WAIT_T waiter;
PID_T pid;
--
2.33.0

View File

@ -0,0 +1,47 @@
From 880489e42a652b84c7de348f0167dfd26abca326 Mon Sep 17 00:00:00 2001
From: Tomas Mraz <tmraz@fedoraproject.org>
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

Binary file not shown.

BIN
cronie-1.6.1.tar.gz Normal file

Binary file not shown.

View File

@ -1,6 +1,6 @@
Name: cronie
Version: 1.5.7
Release: 1
Version: 1.6.1
Release: 5
Summary: Standard UNIX daemon crond
License: GPLv2+ and ISC
URL: https://github.com/cronie-crond/cronie
@ -9,6 +9,9 @@ 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
@ -19,7 +22,7 @@ Requires(post): systemd coreutils sed
Provides: dailyjobs anacron %{name}-anacron %{name}-noanacron
Obsoletes: %{name}-anacron %{name}-noanacron
Obsoletes: %{name}-anacron < %{version}-%{release} %{name}-noanacron < %{version}-%{release}
%description
Cronie contains the standard UNIX daemon crond that runs specified programs
@ -70,7 +73,7 @@ mkdir -p $RPM_BUILD_ROOT/lib/systemd/system/
install -m 644 contrib/cronie.systemd $RPM_BUILD_ROOT/lib/systemd/system/crond.service
%check
make check
%make_build check
%pre
@ -118,6 +121,24 @@ systemctl try-restart crond.service >/dev/null 2>&1 || :
%changelog
* Mon Dec 4 2023 hongjinghao <hongjinghao@huawei.com> - 1.6.1-5
- anacron use xclose instead of fclose
* Thu Jun 15 2023 wangyuhang <wangyuhang27@huawei.com> - 1.6.1-4
- Type:bugfix
- CVE:NA
- SUG:NA
- DESC:Support reloading with SIGURG in addition to SIGHUP
* Wed Feb 15 2023 wangjunqi <wangjunqi@kylinos.cn> - 1.6.1-3
- replace 'make check' with '%make_build check'
* Tue Oct 18 2022 zhangruifang <zhangruifang1@h-partners.com> - 1.6.1-2
- DESC:add version number for Obsoletes
* Fri Jul 22 2022 YukariChiba <i@0x7f.cc> - 1.6.1-1
- Upgrade version to 1.6.1
* Thu Dec 30 2021 wangjie <wangjie375@huawei.com> - 1.5.7-1
- Type:enhancement
- ID:NA