raven-rhel6/gettext/gettext-0.18.1.1-check-if-gets-is-defined.patch
2024-02-21 20:14:44 +06:00

61 lines
2.4 KiB
Diff

From: Michael Olbrich <m.olbrich@pengutronix.de>
Date: Tue, 16 Oct 2012 13:35:50 +0200
Subject: [PATCH] check if 'gets' is defined before undefining it
otherwise compiling fails with glibc-2.16 with
./stdio.h:456:1: error: 'gets' undeclared here (not in a function)
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
---
gettext-runtime/gnulib-lib/stdio.in.h | 2 ++
gettext-tools/gnulib-lib/stdio.in.h | 2 ++
gettext-tools/libgettextpo/stdio.in.h | 2 ++
3 files changed, 6 insertions(+)
diff --git a/gettext-runtime/gnulib-lib/stdio.in.h b/gettext-runtime/gnulib-lib/stdio.in.h
index c43848e..fc0d61b 100644
--- a/gettext-runtime/gnulib-lib/stdio.in.h
+++ b/gettext-runtime/gnulib-lib/stdio.in.h
@@ -140,8 +140,10 @@ _GL_WARN_ON_USE (fflush, "fflush is not always POSIX compliant - "
/* It is very rare that the developer ever has full control of stdin,
so any use of gets warrants an unconditional warning. Assume it is
always declared, since it is required by C89. */
+#if defined gets
#undef gets
_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
+#endif
#if @GNULIB_FOPEN@
# if @REPLACE_FOPEN@
diff --git a/gettext-tools/gnulib-lib/stdio.in.h b/gettext-tools/gnulib-lib/stdio.in.h
index c43848e..fc0d61b 100644
--- a/gettext-tools/gnulib-lib/stdio.in.h
+++ b/gettext-tools/gnulib-lib/stdio.in.h
@@ -140,8 +140,10 @@ _GL_WARN_ON_USE (fflush, "fflush is not always POSIX compliant - "
/* It is very rare that the developer ever has full control of stdin,
so any use of gets warrants an unconditional warning. Assume it is
always declared, since it is required by C89. */
+#if defined gets
#undef gets
_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
+#endif
#if @GNULIB_FOPEN@
# if @REPLACE_FOPEN@
diff --git a/gettext-tools/libgettextpo/stdio.in.h b/gettext-tools/libgettextpo/stdio.in.h
index c43848e..fc0d61b 100644
--- a/gettext-tools/libgettextpo/stdio.in.h
+++ b/gettext-tools/libgettextpo/stdio.in.h
@@ -140,8 +140,10 @@ _GL_WARN_ON_USE (fflush, "fflush is not always POSIX compliant - "
/* It is very rare that the developer ever has full control of stdin,
so any use of gets warrants an unconditional warning. Assume it is
always declared, since it is required by C89. */
+#if defined gets
#undef gets
_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
+#endif
#if @GNULIB_FOPEN@
# if @REPLACE_FOPEN@