diff options
author | Christos Zoulas <christos@zoulas.com> | 2022-09-07 14:15:35 +0000 |
---|---|---|
committer | Christos Zoulas <christos@zoulas.com> | 2022-09-07 14:15:35 +0000 |
commit | b44fc3a12c7d6c98282eacc8b660ab6e21bc718c (patch) | |
tree | 6877b2589998745d4c96752c38815ae76f89d608 | |
parent | fc3fcd15fdcad0066a2d70ded539487334b839d1 (diff) | |
download | file-git-b44fc3a12c7d6c98282eacc8b660ab6e21bc718c.tar.gz |
eat the trailing newline
-rw-r--r-- | tests/test.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/tests/test.c b/tests/test.c index a3b91ba1..6c229bc0 100644 --- a/tests/test.c +++ b/tests/test.c @@ -60,6 +60,8 @@ slurp(FILE *fp, size_t *final_len) } *s++ = c; } + if (s != l && s[-1] == '\n') + s--; if (s == l + len) l = (char *)xrealloc(l, len + 1); *s++ = '\0'; |