1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-18 10:35:55 +00:00

Back out previous. Many people disagreed with removing the warning.

This commit is contained in:
Tim J. Robbins 2003-01-30 23:32:53 +00:00
parent 922b8adbb3
commit 56b9200d1f
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=110127

View File

@ -41,6 +41,7 @@ static char sccsid[] = "@(#)gets.c 8.1 (Berkeley) 6/4/93";
__FBSDID("$FreeBSD$");
#include "namespace.h"
#include <unistd.h>
#include <stdio.h>
#include <sys/cdefs.h>
#include "un-namespace.h"
@ -55,9 +56,16 @@ gets(buf)
{
int c;
char *s;
static int warned;
static char w[] =
"warning: this program uses gets(), which is unsafe.\n";
FLOCKFILE(stdin);
ORIENT(stdin, -1);
if (!warned) {
(void) _write(STDERR_FILENO, w, sizeof(w) - 1);
warned = 1;
}
for (s = buf; (c = __sgetc(stdin)) != '\n';)
if (c == EOF)
if (s == buf) {