From: Michihiro NAKAJIMA Date: Tue, 18 Jan 2011 11:35:10 +0000 (-0500) Subject: pathconf(_PC_REC_INCR_XFER_SIZE) on some platform does not return X-Git-Tag: v3.0.0a~745 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=004da4416a24f4acdd648295eec468af057f6355;p=thirdparty%2Flibarchive.git pathconf(_PC_REC_INCR_XFER_SIZE) on some platform does not return a proper value. SVN-Revision: 2917 --- diff --git a/libarchive/archive_read_disk_posix.c b/libarchive/archive_read_disk_posix.c index b994eaada..3a5381b97 100644 --- a/libarchive/archive_read_disk_posix.c +++ b/libarchive/archive_read_disk_posix.c @@ -579,9 +579,18 @@ setup_suitable_read_buffer(struct archive_read_disk *a) if (cf->max_xfer_size != -1) asize = cf->max_xfer_size + cf->xfer_align; else { - asize = cf->min_xfer_size; + long incr = cf->incr_xfer_size; + /* Some platform does not set a proper value to + * incr_xfer_size.*/ + if (incr < 0) + incr = cf->min_xfer_size; + if (cf->min_xfer_size < 0) { + incr = cf->xfer_align; + asize = cf->xfer_align; + } else + asize = cf->min_xfer_size; while (asize < 1024*64) - asize += cf->incr_xfer_size; + asize += incr; asize += cf->xfer_align; } cf->allocation_ptr = malloc(asize);