X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;ds=sidebyside;f=pkt-line.c;h=355546a1ad844492234dc7ee91528c525af5610a;hb=b90ced0f7da0b8dcdac1aabd8840a23daef25b43;hp=c1e81f976f26726db2432f72f7356087a6e3a7d8;hpb=b8ca3fbd462f94b980af828528c8f1fa59601b57;p=git.git diff --git a/pkt-line.c b/pkt-line.c index c1e81f976..355546a1a 100644 --- a/pkt-line.c +++ b/pkt-line.c @@ -5,7 +5,7 @@ * Write a packetized stream, where each line is preceded by * its length (including the header) as a 4-byte hex number. * A length of 'zero' means end of stream (and a length of 1-3 - * would be an error). + * would be an error). * * This is all pretty stupid, but we use this packetized line * format to make a streaming format possible without ever @@ -65,14 +65,14 @@ void packet_write(int fd, const char *fmt, ...) static void safe_read(int fd, void *buffer, unsigned size) { - int n = 0; + size_t n = 0; while (n < size) { - int ret = xread(fd, (char *) buffer + n, size - n); + ssize_t ret = xread(fd, (char *) buffer + n, size - n); if (ret < 0) die("read error (%s)", strerror(errno)); if (!ret) - die("unexpected EOF"); + die("The remote end hung up unexpectedly"); n += ret; } }