15a207
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
15a207
From: Peter Jones <pjones@redhat.com>
15a207
Date: Wed, 26 Feb 2014 21:49:12 -0500
15a207
Subject: [PATCH] Make "exit" take a return code.
15a207
15a207
This adds "exit" with a return code.  With this patch, any "exit"
15a207
command /may/ include a return code, and on platforms that support
15a207
returning with an exit status, we will do so.  By default we return the
15a207
same exit status we did before this patch.
15a207
15a207
Signed-off-by: Peter Jones <pjones@redhat.com>
15a207
---
15a207
 grub-core/kern/emu/main.c | 6 ++++++
15a207
 grub-core/kern/misc.c     | 9 +++++++++
15a207
 2 files changed, 15 insertions(+)
15a207
15a207
diff --git a/grub-core/kern/emu/main.c b/grub-core/kern/emu/main.c
15a207
index 55ea5a11ccd..7e47ec81263 100644
15a207
--- a/grub-core/kern/emu/main.c
15a207
+++ b/grub-core/kern/emu/main.c
15a207
@@ -72,6 +72,12 @@ grub_exit (int retval __attribute__((unused)))
15a207
   grub_reboot ();
15a207
 }
15a207
 
15a207
+void
15a207
+grub_exit (int retval __attribute__((unused)))
15a207
+{
15a207
+  grub_reboot ();
15a207
+}
15a207
+
15a207
 void
15a207
 grub_machine_init (void)
15a207
 {
15a207
diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c
15a207
index 5ce89a40c68..04371ac49f2 100644
15a207
--- a/grub-core/kern/misc.c
15a207
+++ b/grub-core/kern/misc.c
15a207
@@ -1120,6 +1120,15 @@ grub_abort (void)
15a207
   grub_exit (1);
15a207
 }
15a207
 
15a207
+#if defined (__clang__) && !defined (GRUB_UTIL)
15a207
+/* clang emits references to abort().  */
15a207
+void __attribute__ ((noreturn))
15a207
+abort (void)
15a207
+{
15a207
+  grub_abort ();
15a207
+}
15a207
+#endif
15a207
+
15a207
 void
15a207
 grub_fatal (const char *fmt, ...)
15a207
 {