error: 'gets' undeclared here (not in a function)

problem appear

Compile and install m4-1.4.16.tar.gz
wget http://ftp.gnu.org/gnu/m4/m4-1.4.16.tar.gz
tar xvf m4-1.4.16.tar.gz
./configure
make

报错提示:error: 'gets' undeclared here (not in a function)

Solution:

[root@localhost m4-1.4.16]# vi lib/stdio.in.h
Lookup field : gets is a security hole
Comment :
Set _GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead"); field and His previous comment /* is commented out, as follows

/* 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.
#undef gets
_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead"); */

Then add the following:

#if defined(__GLIBC__) && !defined(__UCLIBC__) && !__GLIBC_PREREQ(2, 16)

_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");

#endif

Recompile and install

make
make install

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326151719&siteId=291194637