image_read returns size_t, so 0 when error or end of file

This commit is contained in:
Pali Rohár committed 2012-08-11 21:23:53 +02:00
1 parent 17c6aefdcb
commit 26099e9536
3 files changed
+6 -5

No files matched your search

+2 -2
View File
@@ -457,7 +457,7 @@ int fiasco_write_to_file(struct fiasco * fiasco, const char * file) {
image_seek(image, 0);
while ( 1 ) {
size = image_read(image, buf, sizeof(buf));
if ( size < 1 )
if ( size == 0 )
break;
WRITE_OR_FAIL(file, fd, buf, size);
}
@@ -543,7 +543,7 @@ int fiasco_unpack(struct fiasco * fiasco, const char * dir) {
image_seek(image, 0);
while ( 1 ) {
size = image_read(image, buf, sizeof(buf));
if ( size < 1 )
if ( size == 0 )
break;
WRITE_OR_FAIL(name, fd, buf, size);
}