summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/io.c7
-rw-r--r--src/package.c2
2 files changed, 4 insertions, 5 deletions
diff --git a/src/io.c b/src/io.c
index c802ed5..77993a2 100644
--- a/src/io.c
+++ b/src/io.c
@@ -936,12 +936,11 @@ static int fdo_write(struct apk_ostream *os, const void *ptr, size_t size)
if (size + fos->bytes >= sizeof(fos->buffer)) {
r = fdo_flush(fos);
- if (r != 0)
- return r;
+ if (r != 0) return r;
if (size >= sizeof(fos->buffer) / 2) {
r = apk_write_fully(fos->fd, ptr, size);
- if (r != size) apk_ostream_cancel(&fos->os, r < 0 ? r : -ENOSPC);
- return r;
+ if (r == size) return 0;
+ return apk_ostream_cancel(&fos->os, r < 0 ? r : -ENOSPC);
}
}
diff --git a/src/package.c b/src/package.c
index b160176..19d49c7 100644
--- a/src/package.c
+++ b/src/package.c
@@ -954,7 +954,7 @@ int apk_pkg_write_index_entry(struct apk_package *info,
return apk_ostream_cancel(os, -ENOBUFS);
bbuf = apk_blob_pushed(APK_BLOB_BUF(buf), bbuf);
- if (apk_ostream_write(os, bbuf.ptr, bbuf.len) ||
+ if (apk_ostream_write(os, bbuf.ptr, bbuf.len) < 0 ||
write_depends(os, "D:", info->depends) ||
write_depends(os, "p:", info->provides) ||
write_depends(os, "i:", info->install_if))