diff --git a/coreutils.spec b/coreutils.spec index 109e69e471ca85b9d6a50f557d3592e591a3b8d2..6f393ec0c738296cf11f7cae1cdf02ed4e42e5f3 100644 --- a/coreutils.spec +++ b/coreutils.spec @@ -2,7 +2,7 @@ Name: coreutils Version: 9.3 -Release: 2 +Release: 3 License: GPLv3+ Summary: A set of basic GNU tools commonly used in shell scripts Url: https://www.gnu.org/software/coreutils/ @@ -25,6 +25,7 @@ Patch8: backport-coreutils-i18n.patch Patch9: backport-pr-fix-infinite-loop-when-double-spacing.patch Patch9000: openEuler-coreutils-df-direct.patch +Patch9001: openEuler-fix-readutmp-systemd-coredump.patch %ifarch sw_64 Patch9001: coreutils-9.0-sw.patch %endif @@ -184,6 +185,9 @@ fi %endif %changelog +* Fri Mar 15 2024 xueyamao - 9.3-3 +- fix readutmp systemd-coredump + * Mon Sep 11 2023 taoyuxiang - 9.3-2 - add sub rpm coreutils-relocation diff --git a/openEuler-fix-readutmp-systemd-coredump.patch b/openEuler-fix-readutmp-systemd-coredump.patch new file mode 100644 index 0000000000000000000000000000000000000000..735aef77fce3668b527b945e5a59e78ab1d1d930 --- /dev/null +++ b/openEuler-fix-readutmp-systemd-coredump.patch @@ -0,0 +1,29 @@ +From 1e6a26f9312bb47e070f94b17b14dc1a6ffbb74f Mon Sep 17 00:00:00 2001 +From: xueyamao +Date: Fri, 15 Mar 2024 17:06:57 +0800 +Subject: [PATCH] fix readutmp-systemd-coredump +Problem reported by Thorsten Kukuk . +* 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. +Signed-off-by: xueyamao +--- + lib/readutmp.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/lib/readutmp.c b/lib/readutmp.c +index 0173b7e..e991586 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) + { + char **session_ptr; + for (session_ptr = sessions; *session_ptr != NULL; session_ptr++) +-- +2.41.0 +