25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

61 lines
2.1 KiB

  1. Minimally modified from upstream
  2. only first change set from lib/stdio.in.h taken
  3. s@lib/stdio@libgnu/stdio@g run on the 'diff' line.
  4. From: Eric Blake <eblake@redhat.com>
  5. Date: Thu, 29 Mar 2012 19:30:41 +0000 (-0600)
  6. Subject: stdio: don't assume gets any more
  7. X-Git-Tag: v0.1~799
  8. X-Git-Url: https://git.savannah.gnu.org/gitweb/?p=gnulib.git;a=commitdiff_plain;h=66712c23388e93e5c518ebc8515140fa0c807348
  9. stdio: don't assume gets any more
  10. Gnulib intentionally does not have a gets module, and now that C11
  11. and glibc have dropped it, we should be more proactive about warning
  12. any user on a platform that still has a declaration of this dangerous
  13. interface.
  14. * m4/stdio_h.m4 (gl_STDIO_H, gl_STDIO_H_DEFAULTS): Drop gets
  15. support.
  16. * modules/stdio (Makefile.am): Likewise.
  17. * gnu/stdio-read.c (gets): Likewise.
  18. * tests/test-stdio-c++.cc: Likewise.
  19. * m4/warn-on-use.m4 (gl_WARN_ON_USE_PREPARE): Fix comment.
  20. * gnu/stdio.in.h (gets): Make warning occur in more places.
  21. * doc/posix-functions/gets.texi (gets): Update documentation.
  22. Reported by Christer Solskogen.
  23. Signed-off-by: Eric Blake <eblake@redhat.com>
  24. ---
  25. diff --git a/libgnu/stdio.in.h b/libgnu/stdio.in.h
  26. index aa7b599..c377b6e 100644
  27. --- a/libgnu/stdio.in.h
  28. +++ b/libgnu/stdio.in.h
  29. @@ -698,22 +698,11 @@ _GL_WARN_ON_USE (getline, "getline is unportable - "
  30. # endif
  31. #endif
  32. -#if @GNULIB_GETS@
  33. -# if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
  34. -# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  35. -# undef gets
  36. -# define gets rpl_gets
  37. -# endif
  38. -_GL_FUNCDECL_RPL (gets, char *, (char *s) _GL_ARG_NONNULL ((1)));
  39. -_GL_CXXALIAS_RPL (gets, char *, (char *s));
  40. -# else
  41. -_GL_CXXALIAS_SYS (gets, char *, (char *s));
  42. -# undef gets
  43. -# endif
  44. -_GL_CXXALIASWARN (gets);
  45. /* It is very rare that the developer ever has full control of stdin,
  46. - so any use of gets warrants an unconditional warning. Assume it is
  47. - always declared, since it is required by C89. */
  48. + so any use of gets warrants an unconditional warning; besides, C11
  49. + removed it. */
  50. +#undef gets
  51. +#if HAVE_RAW_DECL_GETS
  52. _GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
  53. #endif