comparison lib/stdio-read.c @ 16727:683cbe4ca79d

stdio: don't assume gets any more Gnulib intentionally does not have a gets module, and now that C11 and glibc have dropped it, we should be more proactive about warning any user on a platform that still has a declaration of this dangerous interface. * m4/stdio_h.m4 (gl_STDIO_H, gl_STDIO_H_DEFAULTS): Drop gets support. * modules/stdio (Makefile.am): Likewise. * lib/stdio-read.c (gets): Likewise. * tests/test-stdio-c++.cc: Likewise. * m4/warn-on-use.m4 (gl_WARN_ON_USE_PREPARE): Fix comment. * lib/stdio.in.h (gets): Make warning occur in more places. * doc/posix-functions/gets.texi (gets): Update documentation. Reported by Christer Solskogen. Signed-off-by: Eric Blake <eblake@redhat.com>
author Eric Blake <eblake@redhat.com>
date Thu, 29 Mar 2012 13:30:41 -0600
parents 8250f2777afc
children 9e800db3ffe6
comparison
equal deleted inserted replaced
16726:518ff78686bb 16727:683cbe4ca79d
129 #undef fgets 129 #undef fgets
130 { 130 {
131 CALL_WITH_ERRNO_FIX (char *, fgets (s, n, stream), ret == NULL) 131 CALL_WITH_ERRNO_FIX (char *, fgets (s, n, stream), ret == NULL)
132 } 132 }
133 133
134 char * 134 /* We intentionally don't bother to fix gets. */
135 gets (char *s)
136 #undef gets
137 {
138 FILE *stream = stdin;
139 CALL_WITH_ERRNO_FIX (char *, gets (s), ret == NULL)
140 }
141 135
142 size_t 136 size_t
143 fread (void *ptr, size_t s, size_t n, FILE *stream) 137 fread (void *ptr, size_t s, size_t n, FILE *stream)
144 #undef fread 138 #undef fread
145 { 139 {