Commit Diff


commit - f392e333e6fe8e8ce5e2ebc285041cbe95236c5e
commit + b6752625761f06493a89a02076323aa1a0d73819
blob - d504c3cf373260971af39d4b5d4a4b4dbbc12f27
blob + ddf52c6ae8143c17897c8f7a8d6a265bbd26fc7c
--- lib/object.c
+++ lib/object.c
@@ -1111,7 +1111,7 @@ got_object_blob_dump_to_file(size_t *total_len, int *n
     FILE *outfile, struct got_blob_object *blob)
 {
 	const struct got_error *err = NULL;
-	size_t len, hdrlen;
+	size_t n, len, hdrlen;
 	const uint8_t *buf;
 	int i;
 
@@ -1137,7 +1137,9 @@ got_object_blob_dump_to_file(size_t *total_len, int *n
 			}
 		}
 		/* Skip blob object header first time around. */
-		fwrite(buf + hdrlen, len - hdrlen, 1, outfile);
+		n = fwrite(buf + hdrlen, len - hdrlen, 1, outfile);
+		if (n != len - hdrlen)
+			return got_ferror(outfile, GOT_ERR_IO);
 		hdrlen = 0;
 	} while (len != 0);