mirror of
https://git.yoctoproject.org/poky
synced 2026-01-29 21:08:42 +01:00
util-linux: Fix signature of close_range()
close_range expects 3 parameters, thus far it was not implemented in glibc so it was hidden but with glibc 2.34+ it will start to show up (From OE-Core rev: 0d6f638230a96808e22438d9925aec6383d136a7) Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
@@ -41,6 +41,7 @@ SRC_URI = "${KERNELORG_MIRROR}/linux/utils/util-linux/v${MAJOR_VERSION}/util-lin
|
||||
file://tests-ul.patch \
|
||||
file://tests-eject.patch \
|
||||
file://tests-lscpu.patch \
|
||||
file://0001-login-fix-close_range-use.patch \
|
||||
"
|
||||
|
||||
SRC_URI[sha256sum] = "bd07b7e98839e0359842110525a3032fdb8eaf3a90bedde3dd1652d32d15cce5"
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
From 76ae0badd3fd7c8653fa4d3c78d2dcfcec51d23d Mon Sep 17 00:00:00 2001
|
||||
From: Karel Zak <kzak@redhat.com>
|
||||
Date: Wed, 14 Jul 2021 17:25:57 +0200
|
||||
Subject: [PATCH] login: fix close_range() use
|
||||
|
||||
This new syscall comes with three arguments (see kernel commit
|
||||
278a5fbaed89dacd04e9d052f4594ffd0e0585de). Not sure why util-linux
|
||||
assume only two.
|
||||
|
||||
Upstream-Status: Backport [https://github.com/karelzak/util-linux/commit/b8d99a618baffb4fc03cda4c40e29778b6d77ad4]
|
||||
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1981729
|
||||
Signed-off-by: Karel Zak <kzak@redhat.com>
|
||||
---
|
||||
include/fileutils.h | 4 ++--
|
||||
lib/fileutils.c | 2 +-
|
||||
login-utils/login.c | 2 +-
|
||||
3 files changed, 4 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/include/fileutils.h b/include/fileutils.h
|
||||
index ad54b95..f86426b 100644
|
||||
--- a/include/fileutils.h
|
||||
+++ b/include/fileutils.h
|
||||
@@ -82,9 +82,9 @@ static inline struct dirent *xreaddir(DIR *dp)
|
||||
# if defined(SYS_close_range)
|
||||
# include <sys/types.h>
|
||||
# ifndef HAVE_CLOSE_RANGE
|
||||
-static inline int close_range(unsigned int first, unsigned int last)
|
||||
+static inline int close_range(unsigned int first, unsigned int last, int flags)
|
||||
{
|
||||
- return syscall(SYS_close_range, first, last);
|
||||
+ return syscall(SYS_close_range, first, last, flags);
|
||||
}
|
||||
# endif
|
||||
# define HAVE_CLOSE_RANGE 1
|
||||
diff --git a/lib/fileutils.c b/lib/fileutils.c
|
||||
index 846b718..a979b03 100644
|
||||
--- a/lib/fileutils.c
|
||||
+++ b/lib/fileutils.c
|
||||
@@ -189,7 +189,7 @@ int main(int argc, char *argv[])
|
||||
ignore_result( dup(STDIN_FILENO) );
|
||||
|
||||
# ifdef HAVE_CLOSE_RANGE
|
||||
- close_range(STDERR_FILENO + 1, ~0U);
|
||||
+ close_range(STDERR_FILENO + 1, ~0U, 0);
|
||||
# else
|
||||
ul_close_all_fds(STDERR_FILENO + 1, ~0U);
|
||||
# endif
|
||||
diff --git a/login-utils/login.c b/login-utils/login.c
|
||||
index 7fefd05..94a042d 100644
|
||||
--- a/login-utils/login.c
|
||||
+++ b/login-utils/login.c
|
||||
@@ -1358,7 +1358,7 @@ static void initialize(int argc, char **argv, struct login_context *cxt)
|
||||
#endif
|
||||
}
|
||||
#ifdef HAVE_CLOSE_RANGE
|
||||
- close_range(STDERR_FILENO + 1, ~0U);
|
||||
+ close_range(STDERR_FILENO + 1, ~0U, 0);
|
||||
#else
|
||||
ul_close_all_fds(STDERR_FILENO + 1, ~0U);
|
||||
#endif
|
||||
--
|
||||
2.32.0
|
||||
Reference in New Issue
Block a user