glibc/SOURCES/glibc-rh2065588-11.patch

40 lines
969 B
Diff

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 }
};