From 796d29831360c55d8b8b7d9aa5f33c817094c1bf Mon Sep 17 00:00:00 2001 From: Timo Teräs Date: Sat, 17 Jul 2021 17:57:07 +0300 Subject: rework apk_istream_splice and apk_istream_tee - apk_istream_splice usage is converted to apk_stream_copy which is the newer variant. With caching enabled by default, this makes more sense mmapping or using separate buffers. - apk_istream_tee is reworked to write to apk_ostream, which simplifies quite a bit of various things --- src/app_extract.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/app_extract.c') diff --git a/src/app_extract.c b/src/app_extract.c index 9de2bc2..1f11738 100644 --- a/src/app_extract.c +++ b/src/app_extract.c @@ -105,6 +105,7 @@ static int uvol_run(struct apk_ctx *ac, char *action, const char *volname, char static int uvol_extract(struct apk_ctx *ac, char *action, const char *volname, char *arg1, off_t sz, struct apk_istream *is, struct apk_digest_ctx *dctx) { struct apk_out *out = &ac->out; + struct apk_ostream *os; pid_t pid; int r, status, pipefds[2]; char *argv[] = { (char*)apk_ctx_get_uvol(ac), action, (char*) volname, arg1, 0 }; @@ -121,9 +122,10 @@ static int uvol_extract(struct apk_ctx *ac, char *action, const char *volname, c return r; } close(pipefds[0]); - r = apk_istream_splice(is, pipefds[1], sz, 0, 0, dctx); - close(pipefds[1]); - if (r != sz) { + os = apk_ostream_to_fd(pipefds[1]); + apk_stream_copy(is, os, sz, 0, 0, dctx); + r = apk_ostream_close(os); + if (r != 0) { if (r >= 0) r = -APKE_UVOL; apk_err(out, "%s: uvol write error: %s", volname, apk_error_str(r)); return r; -- cgit v1.2.3-70-g09d2