aboutsummaryrefslogtreecommitdiffstats
path: root/src/io.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/io.c')
-rw-r--r--src/io.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/io.c b/src/io.c
index 6b017abe10..ff87c1b294 100644
--- a/src/io.c
+++ b/src/io.c
@@ -832,7 +832,7 @@ struct apk_istream *apk_istream_from_file_gz(int atfd, const char *file)
struct apk_fd_ostream {
struct apk_ostream os;
- int fd, rc;
+ int fd;
const char *file, *tmpfile;
int atfd;
@@ -865,7 +865,7 @@ static ssize_t fdo_flush(struct apk_fd_ostream *fos)
return 0;
if ((r = safe_write(fos->fd, fos->buffer, fos->bytes)) != fos->bytes) {
- fos->rc = r < 0 ? r : -EIO;
+ apk_ostream_cancel(&fos->os, r < 0 ? r : -EIO);
return r;
}
@@ -884,8 +884,7 @@ static ssize_t fdo_write(struct apk_ostream *os, const void *ptr, size_t size)
return r;
if (size >= sizeof(fos->buffer) / 2) {
r = safe_write(fos->fd, ptr, size);
- if (r != size)
- fos->rc = r < 0 ? r : -EIO;
+ if (r != size) apk_ostream_cancel(&fos->os, r < 0 ? r : -EIO);
return r;
}
}
@@ -902,7 +901,7 @@ static int fdo_close(struct apk_ostream *os)
int rc;
fdo_flush(fos);
- rc = fos->rc;
+ rc = fos->os.rc;
if (fos->fd > STDERR_FILENO &&
close(fos->fd) < 0)