diff options
author | midipix <writeonce@midipix.org> | 2021-04-21 04:04:34 +0000 |
---|---|---|
committer | midipix <writeonce@midipix.org> | 2021-04-21 04:06:15 +0000 |
commit | d816c0834d5388df39bd32cf0c0f6668c99cd049 (patch) | |
tree | 31025911b6892b56935eeb78c0a2342ecc33705b /src | |
parent | b6c5aa4aa67df1864d8e21c1c195583d36fcd8ff (diff) | |
download | tpax-d816c0834d5388df39bd32cf0c0f6668c99cd049.tar.bz2 tpax-d816c0834d5388df39bd32cf0c0f6668c99cd049.tar.xz |
tpax_archive_append_one(): always use the mapped memory buffer.
Diffstat (limited to 'src')
-rw-r--r-- | src/logic/tpax_archive_append.c | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/src/logic/tpax_archive_append.c b/src/logic/tpax_archive_append.c index 4b81cb1..ef011fd 100644 --- a/src/logic/tpax_archive_append.c +++ b/src/logic/tpax_archive_append.c @@ -166,7 +166,6 @@ static int tpax_archive_append_one( const char * src; char * dst; char pbuf[1024]; - char sbuf[2048]; /* fake uctx for recursion items */ unit = 0; @@ -254,12 +253,11 @@ static int tpax_archive_append_one( /* associated data? */ if S_ISREG(uctx->st->st_mode) { - if ((buf = tpax_get_driver_anon_map_addr(dctx,&buflen))) - if (buflen >= (cmplen = uctx->st->st_size)) - membuf = buf; + buf = tpax_get_driver_anon_map_addr( + dctx,&buflen); - if (ssizeof(sbuf) >= (uctx->st->st_size)) - membuf = sbuf; + if (buflen >= (cmplen = uctx->st->st_size)) + membuf = buf; /* snapshot */ if (membuf) { @@ -304,10 +302,8 @@ static int tpax_archive_append_one( /* append data from snapshot */ if (fdtmp >= 0) { - if (!buf) { - buf = sbuf; - buflen = sizeof(sbuf); - } + buf = tpax_get_driver_anon_map_addr( + dctx,&buflen); for (nread=0; nread<uctx->st->st_size; ) { nbytes = read(fdtmp,buf,buflen); |