aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLukas Fleischer <calcurse@cryptocrack.de>2011-04-12 18:31:48 +0200
committerLukas Fleischer <calcurse@cryptocrack.de>2011-04-12 18:31:48 +0200
commitcc49f1e2628d345c784dac24fe94bcb3445d4c8d (patch)
tree7017051e7186262c2e1c883ca879ca0ee2f14108 /src
parent57b62a1e49c21143fe977bbefc0a0090791d996d (diff)
downloadcalcurse-cc49f1e2628d345c784dac24fe94bcb3445d4c8d.tar.gz
calcurse-cc49f1e2628d345c784dac24fe94bcb3445d4c8d.zip
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>
Diffstat (limited to 'src')
-rw-r--r--src/io.c2
1 files changed, 1 insertions, 1 deletions
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;