Fix io_file_is_empty() behaviour when file starts with a newline.

Read second byte if the first byte is a newline character to ensure the
file doesn't contain any further data.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
This commit is contained in:
Lukas Fleischer 2011-04-12 18:31:48 +02:00
parent 57b62a1e49
commit cc49f1e262

View File

@ -3051,7 +3051,7 @@ io_file_is_empty (char *file)
if (file && (fp = fopen (file, "r")))
{
if (fgetc (fp) == '\n' || feof (fp))
if ((fgetc (fp) == '\n' && fgetc (fp) == EOF) || feof (fp))
{
fclose (fp);
return 1;