]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
pathconf(_PC_REC_INCR_XFER_SIZE) on some platform does not return
authorMichihiro NAKAJIMA <ggcueroad@gmail.com>
Tue, 18 Jan 2011 11:35:10 +0000 (06:35 -0500)
committerMichihiro NAKAJIMA <ggcueroad@gmail.com>
Tue, 18 Jan 2011 11:35:10 +0000 (06:35 -0500)
a proper value.

SVN-Revision: 2917

libarchive/archive_read_disk_posix.c

index b994eaada17a4ba467cc661085e569524e76e633..3a5381b978caa63e95076ff77560c5976d18f174 100644 (file)
@@ -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);