mirror of
https://git.zx2c4.com/cgit
synced 2025-06-22 01:49:01 +02:00
filter: basic write hooking infrastructure
Filters can now call hook_write and unhook_write if they want to redirect writing to stdout to a different function. This saves us from potential file descriptor pipes and other less efficient mechanisms. We do this instead of replacing the call in html_raw because some places stdlib's printf functions are used (ui-patch or within git itself), which has its own internal buffering, which makes it difficult to interlace our function calls. So, we dlsym libc's write and then override it in the link stage. While we're at it, we move considerations of argument count into the generic new filter handler. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
parent
d750c7a2c9
commit
e83b51b4f6
4 changed files with 67 additions and 23 deletions
2
cgit.c
2
cgit.c
|
@ -904,6 +904,8 @@ int main(int argc, const char **argv)
|
|||
const char *path;
|
||||
int err, ttl;
|
||||
|
||||
cgit_init_filters();
|
||||
|
||||
prepare_context(&ctx);
|
||||
cgit_repolist.length = 0;
|
||||
cgit_repolist.count = 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue