!90 coreutils:add backport-fts-fail-gracefully-when-out-of-memory.patch for malloc failed
From: @ship_harbour Reviewed-by: @openeuler-basic Signed-off-by: @openeuler-basic
This commit is contained in:
commit
d94632fb0f
50
backport-fts-fail-gracefully-when-out-of-memory.patch
Normal file
50
backport-fts-fail-gracefully-when-out-of-memory.patch
Normal file
@ -0,0 +1,50 @@
|
||||
From f17d397771164c1b0f77fea8fb0abdc99cf4a3e1 Mon Sep 17 00:00:00 2001
|
||||
From: ChuanGang Jiang <jiangchuanganghw@outlook.com>
|
||||
Date: Mon, 27 Feb 2023 11:46:12 +0000
|
||||
Subject: [PATCH] fts: fail gracefully when out of memory
|
||||
|
||||
* lib/fts.c (fts_read): Set errno==ENOMEM and return NULL
|
||||
when setup_dir() fails, rather than hitting an assertion later.
|
||||
|
||||
Refernece:https://github.com/coreutils/gnulib/commit/f17d397771164c1b0f77fea8fb0abdc99cf4a3e1
|
||||
Conflict:ChangeLog context adaptation
|
||||
|
||||
---
|
||||
ChangeLog | 6 ++++++
|
||||
lib/fts.c | 6 +++++-
|
||||
2 files changed, 11 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/ChangeLog b/ChangeLog
|
||||
index 1785234..43b0afa 100644
|
||||
--- a/ChangeLog
|
||||
+++ b/ChangeLog
|
||||
@@ -1,3 +1,9 @@
|
||||
+2023-02-27 ChuanGang Jiang <jiangchuanganghw@outlook.com>
|
||||
+
|
||||
+ fts: fail gracefully when out of memory
|
||||
+ * lib/fts.c (fts_read): Set errno==ENOMEM and return NULL
|
||||
+ when setup_dir() fails, rather than hitting an assertion later.
|
||||
+
|
||||
2022-12-06 Paul Eggert <eggert@cs.ucla.edu>
|
||||
|
||||
fts: fix race + mishandling of fstatat failure
|
||||
diff --git a/lib/fts.c b/lib/fts.c
|
||||
index 78584b2902..794a4f75d7 100644
|
||||
--- a/lib/fts.c
|
||||
+++ b/lib/fts.c
|
||||
@@ -979,7 +979,11 @@ next: tmp = p;
|
||||
}
|
||||
free_dir(sp);
|
||||
fts_load(sp, p);
|
||||
- setup_dir(sp);
|
||||
+ if (! setup_dir(sp)) {
|
||||
+ free_dir(sp);
|
||||
+ __set_errno (ENOMEM);
|
||||
+ return (NULL);
|
||||
+ }
|
||||
goto check_for_dir;
|
||||
}
|
||||
|
||||
--
|
||||
2.27.0
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
Name: coreutils
|
||||
Version: 9.0
|
||||
Release: 8
|
||||
Release: 9
|
||||
License: GPLv3+
|
||||
Summary: A set of basic GNU tools commonly used in shell scripts
|
||||
Url: https://www.gnu.org/software/coreutils/
|
||||
@ -36,6 +36,7 @@ Patch20: backport-fts-fix-race-mishandling-of-fstatat-failure.patch
|
||||
Patch21: backport-stty-fix-off-by-one-column-wrapping-on-output.patch
|
||||
Patch22: backport-copy-copy_file_range-handle-ENOENT-for-CIFS.patch
|
||||
Patch23: backport-tail-fix-support-for-F-with-non-seekable-files.patch
|
||||
Patch24: backport-fts-fail-gracefully-when-out-of-memory.patch
|
||||
|
||||
Patch9000: openEuler-coreutils-df-direct.patch
|
||||
%ifarch sw_64
|
||||
@ -163,6 +164,9 @@ fi
|
||||
%{_mandir}/man*/*
|
||||
|
||||
%changelog
|
||||
* Fri Mar 17 2023 jiangchuangang<jiangchuangang@huawei.com> - 9.0-9
|
||||
- add backport-fts-fail-gracefully-when-out-of-memory.patch for malloc failed
|
||||
|
||||
* Fri Mar 17 2023 jiangchuangang<jiangchuangang@huawei.com> - 9.0-8
|
||||
- sync patches from community
|
||||
- add backport-comm-fix-NUL-output-delimiter-with-total.patch
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user