[RFC] use buffered stdio (lightly tested)

Eric Wong e at 80x24.org
Wed Jan 2 10:16:16 CET 2019

> index 70f5b74..2c387c1 100644
> --- a/filter.c
> +++ b/filter.c
> @@ -143,22 +145,22 @@ void cgit_init_filters(void)
>  #endif
>  #ifndef NO_LUA
> -static ssize_t (*libc_write)(int fd, const void *buf, size_t count);
> +static ssize_t (*libc_fwrite)(const void *buf, size_t size, size_t n, FILE *);

Oops, that should be size_t:

  static size_t (*libc_fwrite)(const void *buf, size_t size, size_t n, FILE *);

I also think we need to keep hooking write(2) in addition to
fwrite(3), since (I think) the Lua script may call write(2)
outside of the API we provide it.

More information about the CGit mailing list