Thread (2 messages) flat view 2 messages, 2 authors, 2016-06-15

Re: latest clone/pull of git.git problems with setlinebuf.

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:45:17

Boyd Lynn Gerber [off-list ref] writes:
Hello,

I just noticed that setlinebuf is coming back as undefined when trying
to build the lastest version.

on UnixWare 7.1.4 I get

    LINK git-var
    CC daemon.o
UX:acomp: WARNING: "daemon.c", line 485: end-of-loop code not reached
    LINK git-daemon
Undefined                       first referenced
symbol                              in file
setlinebuf                          daemon.o
UX:ld: ERROR: Symbol referencing errors. No output written to git-daemon
gmake: *** [git-daemon] Error 1
Ah, ok.  I should have noticed that setlinebuf() was outside POSIX (it is
not usable on older BSDs either).

Let's see if we can replace it with setvbuf() which is POSIX.

---
 daemon.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
diff --git c/daemon.c w/daemon.c
index 23278e2..7f2743a 100644
--- c/daemon.c
+++ w/daemon.c
@@ -1083,7 +1083,8 @@ int main(int argc, char **argv)
 		openlog("git-daemon", LOG_PID, LOG_DAEMON);
 		set_die_routine(daemon_die);
 	} else
-		setlinebuf(stderr); /* avoid splitting a message in the middle */
+		/* avoid splitting a message in the middle */
+		setvbuf(stderr, NULL, _IOLBF, 0);
 
 	if (inetd_mode && (group_name || user_name))
 		die("--user and --group are incompatible with --inetd");
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help