mirror of
https://github.com/lua/lua
synced 2024-11-23 05:11:45 +03:00
bug. "fgets" reads n-1 chars.
This commit is contained in:
parent
3c75b75516
commit
b074306267
4
iolib.c
4
iolib.c
@ -3,7 +3,7 @@
|
|||||||
** Input/output library to LUA
|
** Input/output library to LUA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
char *rcs_iolib="$Id: iolib.c,v 1.21 1995/02/06 19:36:13 roberto Exp roberto $";
|
char *rcs_iolib="$Id: iolib.c,v 1.22 1995/10/04 13:53:10 roberto Exp roberto $";
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
@ -251,7 +251,7 @@ static void io_read (void)
|
|||||||
char f[80];
|
char f[80];
|
||||||
char s[256];
|
char s[256];
|
||||||
sprintf (f, "%%%ds", m);
|
sprintf (f, "%%%ds", m);
|
||||||
if (fgets (s, m, in) == NULL)
|
if (fgets (s, m+1, in) == NULL)
|
||||||
{
|
{
|
||||||
lua_pushnil();
|
lua_pushnil();
|
||||||
return;
|
return;
|
||||||
|
Loading…
Reference in New Issue
Block a user