From cc49f1e2628d345c784dac24fe94bcb3445d4c8d Mon Sep 17 00:00:00 2001 From: Lukas Fleischer Date: Tue, 12 Apr 2011 18:31:48 +0200 Subject: 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 --- src/io.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/io.c b/src/io.c index 04ad99f..8cb9804 100644 --- a/src/io.c +++ b/src/io.c @@ -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; -- cgit v1.2.3-70-g09d2