diff options
author | Timo Teräs <timo.teras@iki.fi> | 2020-09-30 14:11:37 +0300 |
---|---|---|
committer | Timo Teräs <timo.teras@iki.fi> | 2020-10-09 16:09:19 +0300 |
commit | efe0c4afecb9fd3da2ab4849d2b8edd5bea14d08 (patch) | |
tree | b04a9d2533148a1fcb4a28560ffd76c4bbc5e5ad /src/io.c | |
parent | 81782bfc150225df75b11efa4fa0ade428ae3676 (diff) | |
download | apk-tools-efe0c4afecb9fd3da2ab4849d2b8edd5bea14d08.tar.gz apk-tools-efe0c4afecb9fd3da2ab4849d2b8edd5bea14d08.tar.bz2 apk-tools-efe0c4afecb9fd3da2ab4849d2b8edd5bea14d08.tar.xz apk-tools-efe0c4afecb9fd3da2ab4849d2b8edd5bea14d08.zip |
adb: introduce apk-tools database format, and few applets
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.c | 9 |
1 files changed, 4 insertions, 5 deletions
@@ -827,7 +827,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; @@ -860,7 +860,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; } @@ -879,8 +879,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; } } @@ -897,7 +896,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) |