backporting posix_spawn-based popen implementation in 2.29

This commit is contained in:
Lin Sinan 2023-03-27 17:05:42 +08:00 committed by 杨桃
parent b75a19c19b
commit 6ada4e1572
14 changed files with 1696 additions and 0 deletions

39
glibc-rh2065588-11.patch Normal file
View file

@ -0,0 +1,39 @@
commit 5a5a3a3234bc220a5192d620e0cbc5360da46f14
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date: Tue Mar 24 15:40:36 2020 -0300
support/shell-container.c: Add builtin exit
Reviewed-by: DJ Delorie <dj@redhat.com>
diff --git a/support/shell-container.c b/support/shell-container.c
index e9eea64bca7e949d..aeaf6d2733abce61 100644
--- a/support/shell-container.c
+++ b/support/shell-container.c
@@ -135,6 +135,18 @@ copy_func (char **argv)
}
+/* Emulate the 'exit' builtin. The exit value is optional. */
+static int
+exit_func (char **argv)
+{
+ int exit_val = 0;
+
+ if (argv[0] != 0)
+ exit_val = atoi (argv[0]) & 0xff;
+ exit (exit_val);
+ return 0;
+}
+
/* This is a list of all the built-in commands we understand. */
static struct {
const char *name;
@@ -143,6 +155,7 @@ static struct {
{ "true", true_func },
{ "echo", echo_func },
{ "cp", copy_func },
+ { "exit", exit_func },
{ NULL, NULL }
};