aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThomas White <taw@bitwiz.org.uk>2016-04-23 21:33:30 +0200
committerThomas White <taw@bitwiz.org.uk>2016-04-23 21:33:30 +0200
commit5cab149c59a13f7000acf6dfd909516ebeeb8f5e (patch)
treed8ff1ed6f0c74b37688f0410d7d1ee9678017de3 /src
parentbf21da066c16bd945f56230f726bc95e70f41bc2 (diff)
Make sure the last bit of the file gets used
Diffstat (limited to 'src')
-rw-r--r--src/presentation.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/presentation.c b/src/presentation.c
index 60c27f8..266535c 100644
--- a/src/presentation.c
+++ b/src/presentation.c
@@ -164,9 +164,15 @@ static char *fgets_long(FILE *fh, size_t *lp)
r = fgetc(fh);
if ( r == EOF ) {
- free(line);
- *lp = 0;
- return NULL;
+ if ( l == 0 ) {
+ free(line);
+ *lp = 0;
+ return NULL;
+ } else {
+ line[l++] = '\0';
+ *lp = l;
+ return line;
+ }
}
line[l++] = r;