OSDN Git Service

upload-pack: keep poll(2)'s timeout to -1
authorEdward Thomson <ethomson@edwardthomson.com>
Fri, 22 Aug 2014 15:19:11 +0000 (15:19 +0000)
committerJunio C Hamano <gitster@pobox.com>
Fri, 22 Aug 2014 18:19:47 +0000 (11:19 -0700)
Keep poll's timeout at -1 when uploadpack.keepalive = 0, instead of
setting it to -1000, since some pedantic old systems (eg HP-UX) and
the gnulib compat/poll will treat only -1 as the valid value for
an infinite timeout.

Signed-off-by: Edward Thomson <ethomson@microsoft.com>
Acked-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
upload-pack.c

index a3c52f6..12c6b4d 100644 (file)
@@ -158,7 +158,9 @@ static void create_pack_file(void)
                if (!pollsize)
                        break;
 
-               ret = poll(pfd, pollsize, 1000 * keepalive);
+               ret = poll(pfd, pollsize,
+                       keepalive < 0 ? -1 : 1000 * keepalive);
+
                if (ret < 0) {
                        if (errno != EINTR) {
                                error("poll failed, resuming: %s",