summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristos Zoulas <christos@zoulas.com>2022-09-07 14:15:35 +0000
committerChristos Zoulas <christos@zoulas.com>2022-09-07 14:15:35 +0000
commitb44fc3a12c7d6c98282eacc8b660ab6e21bc718c (patch)
tree6877b2589998745d4c96752c38815ae76f89d608
parentfc3fcd15fdcad0066a2d70ded539487334b839d1 (diff)
downloadfile-git-b44fc3a12c7d6c98282eacc8b660ab6e21bc718c.tar.gz
eat the trailing newline
-rw-r--r--tests/test.c2
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';