Files
poky/meta/recipes-extended/shadow/files/0001-lib-copydir-copy_entry-use-temporary-stat-buffer.patch
Alexander Kanavin 46d33a45d6 shadow: update 4.14.2 -> 4.15.0
libcrack support was dropped.

(From OE-Core rev: c976d67cc73948eb09700be349d63a5d3840acdc)

Signed-off-by: Alexander Kanavin <alex@linutronix.de>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-04-16 08:07:02 +01:00

38 lines
1.2 KiB
Diff

From af4b8cb780587aa736692a3baa76b60474f19c5d Mon Sep 17 00:00:00 2001
From: Enrico Scholz <enrico.scholz@sigma-chemnitz.de>
Date: Mon, 18 Mar 2024 12:14:21 +0100
Subject: [PATCH] lib/copydir:copy_entry(): use temporary stat buffer
There are no guarantees that fstatat() does not clobber the stat
buffer on errors.
Use a temporary buffer so that the following code sees correct
attributes of the source entry.
Upstream-Status: Submitted [https://github.com/shadow-maint/shadow/pull/974]
Signed-off-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de>
---
lib/copydir.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
--- a/lib/copydir.c
+++ b/lib/copydir.c
@@ -400,6 +400,7 @@ static int copy_entry (const struct path
{
int err = 0;
struct stat sb;
+ struct stat tmp_sb;
struct link_name *lp;
struct timespec mt[2];
@@ -423,7 +424,7 @@ static int copy_entry (const struct path
* If the destination already exists do nothing.
* This is after the copy_dir above to still iterate into subdirectories.
*/
- if (fstatat(dst->dirfd, dst->name, &sb, AT_SYMLINK_NOFOLLOW) != -1) {
+ if (fstatat(dst->dirfd, dst->name, &tmp_sb, AT_SYMLINK_NOFOLLOW) != -1) {
return err;
}