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:
@@ -3051,7 +3051,7 @@ io_file_is_empty (char *file)
|
|||||||
|
|
||||||
if (file && (fp = fopen (file, "r")))
|
if (file && (fp = fopen (file, "r")))
|
||||||
{
|
{
|
||||||
if (fgetc (fp) == '\n' || feof (fp))
|
if ((fgetc (fp) == '\n' && fgetc (fp) == EOF) || feof (fp))
|
||||||
{
|
{
|
||||||
fclose (fp);
|
fclose (fp);
|
||||||
return 1;
|
return 1;
|
||||||
|
|||||||
Reference in New Issue
Block a user