diff options
author | Ulrich Drepper <drepper@gmail.com> | 2012-01-24 17:40:44 -0500 |
---|---|---|
committer | Ulrich Drepper <drepper@gmail.com> | 2012-01-24 17:40:44 -0500 |
commit | b15549e6f8d5936c4312b022ac8910823f2c2280 (patch) | |
tree | 9e0a26dfb17b4e9c3cb89a38d5ec9a7f460236de /include | |
parent | d220b1177777a2cd00d1b1eae62e1071a17ab46b (diff) | |
download | glibc-b15549e6f8d5936c4312b022ac8910823f2c2280.tar.gz |
Fix gets problems
Diffstat (limited to 'include')
-rw-r--r-- | include/stdio.h | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/include/stdio.h b/include/stdio.h index 5f4495d0d0..48aa765e02 100644 --- a/include/stdio.h +++ b/include/stdio.h @@ -5,6 +5,8 @@ # include <libio/stdio.h> /* Now define the internal interfaces. */ +__BEGIN_DECLS + extern int __fcloseall (void); extern int __snprintf (char *__restrict __s, size_t __maxlen, const char *__restrict __format, ...) @@ -164,6 +166,26 @@ libc_hidden_proto (__vfprintf_chk) libc_hidden_proto (__vasprintf_chk) libc_hidden_proto (__vdprintf_chk) libc_hidden_proto (__obstack_vprintf_chk) + +/* The <stdio.h> header does not include the declaration for gets + anymore when compiling with _GNU_SOURCE. Provide a copy here. */ +extern char *gets (char *__s); +# if __USE_FORTIFY_LEVEL > 0 +extern char *__gets_chk (char *__str, size_t) __wur; +extern char *__REDIRECT (__gets_warn, (char *__str), gets) + __wur __warnattr ("please use fgets or getline instead, gets can't " + "specify buffer size"); + +__extern_always_inline __wur char * +gets (char *__str) +{ + if (__bos (__str) != (size_t) -1) + return __gets_chk (__str, __bos (__str)); + return __gets_warn (__str); +} +# endif + +__END_DECLS # endif #endif |