diff options
| author | Bryce Kwon <bryce@brycekwon.com> | |
|---|---|---|
| committer | Bryce Kwon <bryce@brycekwon.com> | |
| commit | ||
| parent | ||
| tree | ||
| download | ||
Find libc's write when git writes first
A Lua build replaces write, and git can write before cmd_main reaches
cgit_init_filters, as it does when GIT_TRACE2 is set, which called
through a null pointer and crashed every request.
Diffstat (limited to '')
| -rw-r--r-- | source/filter.c | 4 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1 file changed, 4 insertions, 0 deletions
diff --git a/source/filter.c b/source/filter.c index 43ba70a..f2dfe12 100644 --- a/source/filter.c +++ b/source/filter.c @@ -166,6 +166,10 @@ void cgit_init_filters(void) */ ssize_t write(int fd, const void *buf, size_t count) { + // Git can write before cmd_main reaches cgit_init_filters, to a trace + // target for one, so libc's write may still need looking up here. + if (!libc_write) + cgit_init_filters(); if (fd != STDOUT_FILENO || !filter_write) return libc_write(fd, buf, count); return filter_write(current_write_filter, buf, count); |
