author | Junio C Hamano <gitster@pobox.com> | |
Thu, 4 Sep 2008 03:33:29 +0000 (20:33 -0700) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Sun, 7 Sep 2008 03:23:32 +0000 (20:23 -0700) | ||
commit | 48196afd2827b36ca5768f886f0866b6dfebdd10 | |
tree | 41e542e7c0dc6061436c14f1812c12517bbcb399 | tree | snapshot |
parent | 80d12c23de4fbddfaee2f9bf7fe809f57d02e171 | commit | diff |
daemon.c: avoid setlinebuf()
This function is outside POSIX (Linux and recent BSD have it). Replace it
with setvbuf() which is POSIX.
I am not sure about the value this patch passes as size argument to
setvbuf(), though. I know the call this patch makes is equivalent to
calling setlinebuf() with GNU libc, but POSIX itself leaves what happens
to the size argument quite vague, saying only "otherwise [i.e. when buf is
a null pointer], size _may_ determine the size of a buffer allocated by
the setvbuf() function." If passing size=0 causes stdio to allocate very
small buffer, and while stdio tries to line buffer the output, it might
make it to fail to buffer an entire line, causing early flushing of the
stream.
Even if that turns out to be a problem on minorority platforms, we won't
know it until the issue actually hurts them, so let's push this change out
and see what happens.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This function is outside POSIX (Linux and recent BSD have it). Replace it
with setvbuf() which is POSIX.
I am not sure about the value this patch passes as size argument to
setvbuf(), though. I know the call this patch makes is equivalent to
calling setlinebuf() with GNU libc, but POSIX itself leaves what happens
to the size argument quite vague, saying only "otherwise [i.e. when buf is
a null pointer], size _may_ determine the size of a buffer allocated by
the setvbuf() function." If passing size=0 causes stdio to allocate very
small buffer, and while stdio tries to line buffer the output, it might
make it to fail to buffer an entire line, causing early flushing of the
stream.
Even if that turns out to be a problem on minorority platforms, we won't
know it until the issue actually hurts them, so let's push this change out
and see what happens.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
daemon.c | diff | blob | history |