]>
Commit | Line | Data |
---|---|---|
b4f4c809 MK |
1 | From f5fab01434b096b3bc2b058fec41123392eb3dcb Mon Sep 17 00:00:00 2001 |
2 | From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com> | |
3 | Date: Wed, 8 Aug 2012 14:13:16 +0200 | |
4 | Subject: [PATCH] Fix building with glibc-2.16.6 | |
5 | ||
6 | Ported to libprelude-1.0.0 from gnulib commit: | |
7 | ||
8 | From 66712c23388e93e5c518ebc8515140fa0c807348 Mon Sep 17 00:00:00 2001 | |
9 | From: Eric Blake <eblake@redhat.com> | |
10 | Date: Thu, 29 Mar 2012 13:30:41 -0600 | |
11 | Subject: [PATCH] stdio: don't assume gets any more | |
12 | ||
13 | Gnulib intentionally does not have a gets module, and now that C11 | |
14 | and glibc have dropped it, we should be more proactive about warning | |
15 | any user on a platform that still has a declaration of this dangerous | |
16 | interface. | |
17 | --- | |
18 | libmissing/m4/stdio_h.m4 | 4 ++-- | |
19 | libmissing/m4/warn-on-use.m4 | 4 ++-- | |
20 | libmissing/stdio.in.h | 6 ++++-- | |
21 | 3 files changed, 8 insertions(+), 6 deletions(-) | |
22 | ||
23 | diff --git a/libmissing/m4/stdio_h.m4 b/libmissing/m4/stdio_h.m4 | |
24 | index 781fa8d..fc65d37 100644 | |
25 | --- a/libmissing/m4/stdio_h.m4 | |
26 | +++ b/libmissing/m4/stdio_h.m4 | |
27 | @@ -34,9 +34,9 @@ AC_DEFUN([gl_STDIO_H], | |
28 | ||
29 | dnl Check for declarations of anything we want to poison if the | |
30 | dnl corresponding gnulib module is not in use, and which is not | |
31 | - dnl guaranteed by C89. | |
32 | + dnl guaranteed by both C89 and C11. | |
33 | gl_WARN_ON_USE_PREPARE([[#include <stdio.h> | |
34 | - ]], [dprintf fpurge fseeko ftello getdelim getline popen renameat | |
35 | + ]], [dprintf fpurge fseeko ftello getdelim getline gets popen renameat | |
36 | snprintf vdprintf vsnprintf]) | |
37 | ]) | |
38 | ||
39 | diff --git a/libmissing/m4/warn-on-use.m4 b/libmissing/m4/warn-on-use.m4 | |
40 | index ab46422..494e00b 100644 | |
41 | --- a/libmissing/m4/warn-on-use.m4 | |
42 | +++ b/libmissing/m4/warn-on-use.m4 | |
43 | @@ -18,8 +18,8 @@ dnl with or without modifications, as long as this notice is preserved. | |
44 | # some systems declare functions in the wrong header, then INCLUDES | |
45 | # should do likewise. | |
46 | # | |
47 | -# If you assume C89, then it is generally safe to assume declarations | |
48 | -# for functions declared in that standard (such as gets) without | |
49 | +# It is generally safe to assume declarations for functions declared | |
50 | +# in the intersection of C89 and C11 (such as printf) without | |
51 | # needing gl_WARN_ON_USE_PREPARE. | |
52 | AC_DEFUN([gl_WARN_ON_USE_PREPARE], | |
53 | [ | |
54 | diff --git a/libmissing/stdio.in.h b/libmissing/stdio.in.h | |
55 | index f5d5d88..6924ef2 100644 | |
56 | --- a/libmissing/stdio.in.h | |
57 | +++ b/libmissing/stdio.in.h | |
58 | @@ -114,10 +114,12 @@ _GL_WARN_ON_USE (fflush, "fflush is not always POSIX compliant - " | |
59 | #endif | |
60 | ||
61 | /* It is very rare that the developer ever has full control of stdin, | |
62 | - so any use of gets warrants an unconditional warning. Assume it is | |
63 | - always declared, since it is required by C89. */ | |
64 | + so any use of gets warrants an unconditional warning; besides, C11 | |
65 | + removed it. */ | |
66 | #undef gets | |
67 | +#if HAVE_RAW_DECL_GETS | |
68 | _GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead"); | |
69 | +#endif | |
70 | ||
71 | #if @GNULIB_FOPEN@ | |
72 | # if @REPLACE_FOPEN@ | |
73 | -- | |
74 | 1.7.11.2 | |
75 |