Re: [PATCH] fix hang in git fetch if pointed at a 0 length bundle

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jan 3, 2012 at 8:13 AM, Brian Harring <ferringb@xxxxxxxxx> wrote:
> @@ -31,7 +31,7 @@ static int strbuf_readline_fd(struct strbuf *sb, int fd)
>        while (1) {
>                char ch;
>                ssize_t len = xread(fd, &ch, 1);
> -               if (len < 0)
> +               if (len <= 0)
>                        return -1;
>                strbuf_addch(sb, ch);
>                if (ch == '\n')

I think it should return 0 when len == 0 because strictly speaking eof
is not a fault. It's not really important though because the two
callers in this file work fine either way.

FWIW I went through all xread call sites. All seem to handle return
value <= 0 correctly.
-- 
Duy
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]