fix coredump if enable systemd
Signed-off-by: xueyamao <xueyamao@kylinos.cn>
This commit is contained in:
parent
2bfa683acc
commit
325df577e1
@ -1,6 +1,6 @@
|
|||||||
Name: coreutils
|
Name: coreutils
|
||||||
Version: 9.4
|
Version: 9.4
|
||||||
Release: 2
|
Release: 3
|
||||||
License: GPLv3+
|
License: GPLv3+
|
||||||
Summary: A set of basic GNU tools commonly used in shell scripts
|
Summary: A set of basic GNU tools commonly used in shell scripts
|
||||||
Url: https://www.gnu.org/software/coreutils/
|
Url: https://www.gnu.org/software/coreutils/
|
||||||
@ -23,7 +23,7 @@ Patch8: backport-coreutils-df-direct.patch
|
|||||||
Patch9: backport-coreutils-i18n.patch
|
Patch9: backport-coreutils-i18n.patch
|
||||||
patch10: backport-CVE-2024-0684-split-do-not-shrink-hold-buffer.patch
|
patch10: backport-CVE-2024-0684-split-do-not-shrink-hold-buffer.patch
|
||||||
patch11: test-skip-overlay-filesystem-because-of-no-inotify_add_watch.patch
|
patch11: test-skip-overlay-filesystem-because-of-no-inotify_add_watch.patch
|
||||||
|
patch12: fix-coredump-if-enable-systemd.patch
|
||||||
%ifarch sw_64
|
%ifarch sw_64
|
||||||
Patch9001: coreutils-9.0-sw.patch
|
Patch9001: coreutils-9.0-sw.patch
|
||||||
%endif
|
%endif
|
||||||
@ -155,6 +155,9 @@ fi
|
|||||||
%{_mandir}/man*/*
|
%{_mandir}/man*/*
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Fri Mar 15 2024 xueyamao<xueyamao@kylinos.cn> - 9.4-3
|
||||||
|
- fix coredump if enable systemd
|
||||||
|
|
||||||
* Fri Feb 2 2024 jiangchuangang <jiangchuangang@huawei.com> - 9.4-2
|
* Fri Feb 2 2024 jiangchuangang <jiangchuangang@huawei.com> - 9.4-2
|
||||||
- skip testcase for overlay filesystem because of no inotify_add_watch
|
- skip testcase for overlay filesystem because of no inotify_add_watch
|
||||||
add test-skip-overlay-filesystem-because-of-no-inotify_add_watch.patch
|
add test-skip-overlay-filesystem-because-of-no-inotify_add_watch.patch
|
||||||
|
|||||||
35
fix-coredump-if-enable-systemd.patch
Normal file
35
fix-coredump-if-enable-systemd.patch
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
From d501347a8ae23a2fb312949c588c7565eb54b2da Mon Sep 17 00:00:00 2001
|
||||||
|
From: Paul Eggert <eggert@cs.ucla.edu>
|
||||||
|
Date: Mon, 18 Mar 2024 09:10:31 +0800
|
||||||
|
Subject: [PATCH] fix core dump if --enable-systemd
|
||||||
|
|
||||||
|
From gnulib upstream commits:
|
||||||
|
* 1e6a26f9312bb47e070f94b17b14dc1a6ffbb74f ("readutmp: fix core dump if --enable-systemd")
|
||||||
|
Problem reported by Thorsten Kukuk <https://bugs.gnu.org/65617>.
|
||||||
|
lib/readutmp.c (read_utmp_from_systemd):
|
||||||
|
Don’t assume session_ptr != NULL if num_sessions == 0.
|
||||||
|
In practice it can be null, and the man page OKs this behavior.
|
||||||
|
|
||||||
|
* 3af1d7b0ce3a8e3ae565e7cea10cee6fd7cb8109 ("readutmp: Fix memory leak introduced by last commit.")
|
||||||
|
lib/readutmp.c (read_utmp_from_systemd): If num_sessions == 0 and
|
||||||
|
sessions != NULL, do call free (sessions).
|
||||||
|
---
|
||||||
|
lib/readutmp.c | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/lib/readutmp.c b/lib/readutmp.c
|
||||||
|
index 0173b7e..ec09feb 100644
|
||||||
|
--- a/lib/readutmp.c
|
||||||
|
+++ b/lib/readutmp.c
|
||||||
|
@@ -795,7 +795,7 @@ read_utmp_from_systemd (idx_t *n_entries, STRUCT_UTMP **utmp_buf, int options)
|
||||||
|
{
|
||||||
|
char **sessions;
|
||||||
|
int num_sessions = sd_get_sessions (&sessions);
|
||||||
|
- if (num_sessions >= 0)
|
||||||
|
+ if (num_sessions >= 0 && sessions != NULL)
|
||||||
|
{
|
||||||
|
char **session_ptr;
|
||||||
|
for (session_ptr = sessions; *session_ptr != NULL; session_ptr++)
|
||||||
|
--
|
||||||
|
2.41.0
|
||||||
|
|
||||||
Loading…
x
Reference in New Issue
Block a user