a5bd9f6
From d09689a5a2863043d007c1acb9bf0a8d1d3b776d Mon Sep 17 00:00:00 2001
a5bd9f6
From: Colin Watson <cjwatson@ubuntu.com>
a5bd9f6
Date: Fri, 28 Dec 2012 06:43:35 +0000
a5bd9f6
Subject: [PATCH 069/364] Backport gnulib fixes for C11.  Fixes Savannah bug
a5bd9f6
 #37738.
a5bd9f6
a5bd9f6
* grub-core/gnulib/stdio.in.h (gets): Warn on use only if
a5bd9f6
HAVE_RAW_DECL_GETS.
a5bd9f6
* m4/stdio_h.m4 (gl_STDIO_H): Check for gets.
a5bd9f6
---
a5bd9f6
 ChangeLog                   | 8 ++++++++
a5bd9f6
 grub-core/gnulib/stdio.in.h | 6 ++++--
a5bd9f6
 m4/stdio_h.m4               | 2 +-
a5bd9f6
 3 files changed, 13 insertions(+), 3 deletions(-)
a5bd9f6
a5bd9f6
diff --git a/ChangeLog b/ChangeLog
a5bd9f6
index 9104a46..0f04f5c 100644
a5bd9f6
--- a/ChangeLog
a5bd9f6
+++ b/ChangeLog
a5bd9f6
@@ -1,3 +1,11 @@
a5bd9f6
+2012-12-28  Colin Watson  <cjwatson@ubuntu.com>
a5bd9f6
+
a5bd9f6
+	Backport gnulib fixes for C11.  Fixes Savannah bug #37738.
a5bd9f6
+
a5bd9f6
+	* grub-core/gnulib/stdio.in.h (gets): Warn on use only if
a5bd9f6
+	HAVE_RAW_DECL_GETS.
a5bd9f6
+	* m4/stdio_h.m4 (gl_STDIO_H): Check for gets.
a5bd9f6
+
a5bd9f6
 2012-12-11  Vladimir Serbinenko  <phcoder@gmail.com>
a5bd9f6
 
a5bd9f6
 	* util/grub.d/20_linux_xen.in: Addmissing assignment to machine.
a5bd9f6
diff --git a/grub-core/gnulib/stdio.in.h b/grub-core/gnulib/stdio.in.h
a5bd9f6
index 80b9dbf..a8b00c6 100644
a5bd9f6
--- a/grub-core/gnulib/stdio.in.h
a5bd9f6
+++ b/grub-core/gnulib/stdio.in.h
a5bd9f6
@@ -138,10 +138,12 @@ _GL_WARN_ON_USE (fflush, "fflush is not always POSIX compliant - "
a5bd9f6
 #endif
a5bd9f6
 
a5bd9f6
 /* It is very rare that the developer ever has full control of stdin,
a5bd9f6
-   so any use of gets warrants an unconditional warning.  Assume it is
a5bd9f6
-   always declared, since it is required by C89.  */
a5bd9f6
+   so any use of gets warrants an unconditional warning; besides, C11
a5bd9f6
+   removed it.  */
a5bd9f6
 #undef gets
a5bd9f6
+#if HAVE_RAW_DECL_GETS
a5bd9f6
 _GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
a5bd9f6
+#endif
a5bd9f6
 
a5bd9f6
 #if @GNULIB_FOPEN@
a5bd9f6
 # if @REPLACE_FOPEN@
a5bd9f6
diff --git a/m4/stdio_h.m4 b/m4/stdio_h.m4
a5bd9f6
index f5650cd..8458bec 100644
a5bd9f6
--- a/m4/stdio_h.m4
a5bd9f6
+++ b/m4/stdio_h.m4
a5bd9f6
@@ -37,7 +37,7 @@ AC_DEFUN([gl_STDIO_H],
a5bd9f6
   dnl corresponding gnulib module is not in use, and which is not
a5bd9f6
   dnl guaranteed by C89.
a5bd9f6
   gl_WARN_ON_USE_PREPARE([[#include <stdio.h>
a5bd9f6
-    ]], [dprintf fpurge fseeko ftello getdelim getline popen renameat
a5bd9f6
+    ]], [dprintf fpurge fseeko ftello getdelim getline gets popen renameat
a5bd9f6
     snprintf tmpfile vdprintf vsnprintf])
a5bd9f6
 ])
a5bd9f6
 
a5bd9f6
-- 
a5bd9f6
1.8.1.4
a5bd9f6