From d816c0834d5388df39bd32cf0c0f6668c99cd049 Mon Sep 17 00:00:00 2001 From: midipix Date: Wed, 21 Apr 2021 04:04:34 +0000 Subject: tpax_archive_append_one(): always use the mapped memory buffer. --- src/logic/tpax_archive_append.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'src') 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; nreadst->st_size; ) { nbytes = read(fdtmp,buf,buflen); -- cgit v1.2.3