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