* libc/stdio/gets.c (_gets_r): Lock stdin here and call
__sgetc_r instead of _getchar_r.
This commit is contained in:
parent
de33833d1f
commit
a11451b353
@ -1,3 +1,8 @@
|
|||||||
|
2008-11-25 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
|
* libc/stdio/gets.c (_gets_r): Lock stdin here and call
|
||||||
|
__sgetc_r instead of _getchar_r.
|
||||||
|
|
||||||
2008-11-24 Craig Howland <howland@LGSInnovations.com>
|
2008-11-24 Craig Howland <howland@LGSInnovations.com>
|
||||||
|
|
||||||
* libc/stdlib/wcstoull_r.c: Add EINVAL return for bad base value,
|
* libc/stdlib/wcstoull_r.c: Add EINVAL return for bad base value,
|
||||||
|
@ -79,15 +79,20 @@ _DEFUN(_gets_r, (ptr, buf),
|
|||||||
register int c;
|
register int c;
|
||||||
register char *s = buf;
|
register char *s = buf;
|
||||||
|
|
||||||
while ((c = _getchar_r (ptr)) != '\n')
|
_flockfile (stdin);
|
||||||
|
while ((c = __sgetc_r (ptr, stdin)) != '\n')
|
||||||
if (c == EOF)
|
if (c == EOF)
|
||||||
if (s == buf)
|
if (s == buf)
|
||||||
|
{
|
||||||
|
_funlockfile (stdin);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
break;
|
break;
|
||||||
else
|
else
|
||||||
*s++ = c;
|
*s++ = c;
|
||||||
*s = 0;
|
*s = 0;
|
||||||
|
_funlockfile (stdin);
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user