aboutsummaryrefslogtreecommitdiffstats
path: root/src/io.c
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2019-12-13 15:22:33 +0200
committerTimo Teräs <timo.teras@iki.fi>2020-02-28 23:18:52 +0200
commit9530fbfa044bedf5821ff5ffffb7d4f3994f603f (patch)
treea54a0dcc1eff93429c822fcb89dfaccb73ab6285 /src/io.c
parentc054fbc11e9beca0d45285c3e1f448c81416c5ce (diff)
downloadapk-tools-v3.0-wip.tar.bz2
apk-tools-v3.0-wip.tar.xz
adb: introduce apk-tools database format, and few appletsv3.0-wip
This is a flat buffers inspired format that allows fast mmaped access to the data with low overhead, signature support and relatively good forward support.
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 6b017ab..ff87c1b 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)