commit - 344e474767f52e48fa8b238638b9507b2002f4d4
commit + 38c670f14feb46a50c367924ad72f88dddfbad01
blob - 7dba862a0feb7f94085895c18ed8b65612694135
blob + e593a8ed5db8f3e51ad09cbd00486332aef60259
--- libexec/got-fetch-pack/got-fetch-pack.c
+++ libexec/got-fetch-pack/got-fetch-pack.c
return NULL;
}
-static int
+static const struct got_error *
flushpkt(int fd)
{
+ ssize_t w;
+
if (chattygit)
fprintf(stderr, "writepkt: 0000\n");
- return write(fd, "0000", 4);
+
+ w = write(fd, "0000", 4);
+ if (w == -1)
+ return got_error_from_errno("write");
+ if (w != 4)
+ return got_error(GOT_ERR_IO);
+ return NULL;
}
goto done;
req = 1;
}
- flushpkt(fd);
+ err = flushpkt(fd);
+ if (err)
+ goto done;
for (i = 0; i < nref; i++) {
if (got_object_id_cmp(&have[i], &zhash) == 0)
continue;
}
if (!req) {
fprintf(stderr, "up to date\n");
- flushpkt(fd);
+ err = flushpkt(fd);
+ if (err)
+ goto done;
}
n = snprintf(buf, sizeof(buf), "done\n");
err = writepkt(fd, buf, n);