summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortsxv478 <atvx717@infraredcombat.xyz>2024-11-29 00:01:03 +0300
committertsxv478 <atvx717@infraredcombat.xyz>2024-11-29 00:01:03 +0300
commit661ccea88ae56357f175cbcbb893263cf90ab623 (patch)
treeb38d85782fe65af989f9ee138c1aa9bef0c2d24f
parentb0fb9d02ac9b9b0dc325da599a254fcabc8f8f77 (diff)
last(): exit if file is emptyHEADmaster
-rw-r--r--note.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/note.c b/note.c
index 3cca833..4883be1 100644
--- a/note.c
+++ b/note.c
@@ -76,7 +76,9 @@ last(char *fullpath)
}
fseek(fp, 0, SEEK_END);
- pos = ftell(fp);
+
+ if (!(pos = ftell(fp)))
+ exit(0);
while (1) {
fseek(fp, --pos, SEEK_SET);