From 0e497ef53fda1931985d46259660d85a6ea3e13b Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Sat, 31 Oct 2026 13:57:29 -0700 Subject: Drop cgit_read_first_line's unread size output --- source/shared.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'source/shared.c') diff --git a/source/shared.c b/source/shared.c index d159a7a..30e2e12 100644 --- a/source/shared.c +++ b/source/shared.c @@ -505,7 +505,7 @@ void cgit_prepare_repo_env(struct cgit_repo *repo) vars[i].name, vars[i].value, strerror(errno), errno); } -int cgit_read_first_line(const char *path, char **buf, size_t *size) +int cgit_read_first_line(const char *path, char **buf) { int fd, err; ssize_t got; @@ -533,12 +533,10 @@ int cgit_read_first_line(const char *path, char **buf, size_t *size) err = errno; free(*buf); *buf = NULL; - *size = 0; close(fd); return err; } - *size = got; - (*buf)[*size] = '\0'; + (*buf)[got] = '\0'; *strchrnul(*buf, '\n') = '\0'; close(fd); return 0; -- cgit