Move setvbuf calls from gz_open() to calling functions, setvbuf is only supposed...
authorGlenn L McGrath <bug1@ihug.co.nz>
Fri, 13 Jul 2001 06:43:03 +0000 (06:43 -0000)
committerGlenn L McGrath <bug1@ihug.co.nz>
Fri, 13 Jul 2001 06:43:03 +0000 (06:43 -0000)
archival/gunzip.c
archival/tar.c
gunzip.c
libbb/unarchive.c
tar.c

index c4e84260b20c9c6559003a7fb8c8e91453f9743d..430bc630efc80daef9949eac46ab431d4fa9ab18 100644 (file)
@@ -118,6 +118,9 @@ extern int gunzip_main(int argc, char **argv)
                /* Open input file */
                in_file = xfopen(if_name, "r");
 
+               /* set the buffer size */
+               setvbuf(in_file, NULL, _IOFBF, 0x8000);
+
                /* Get the time stamp on the input file. */
                if (stat(if_name, &stat_buf) < 0) {
                        error_msg_and_die("Couldn't stat file %s", if_name);
index 31443ee22aa7314d2c30922ce0363cf66864eaf4..cf65798fffd6e665e297fcd6d2ebc36954ac3a9b 100644 (file)
@@ -284,6 +284,10 @@ extern int tar_main(int argc, char **argv)
                /* unzip tarFd in a seperate process */
                if (unzipFlag == TRUE) {
                        comp_file = fdopen(tarFd, "r");
+
+                       /* set the buffer size */
+                       setvbuf(comp_file, NULL, _IOFBF, 0x8000);
+
                        if ((tarFd = fileno(gz_open(comp_file, &pid))) == EXIT_FAILURE) {
                                error_msg_and_die("Couldnt unzip file");
                        }
index c4e84260b20c9c6559003a7fb8c8e91453f9743d..430bc630efc80daef9949eac46ab431d4fa9ab18 100644 (file)
--- a/gunzip.c
+++ b/gunzip.c
@@ -118,6 +118,9 @@ extern int gunzip_main(int argc, char **argv)
                /* Open input file */
                in_file = xfopen(if_name, "r");
 
+               /* set the buffer size */
+               setvbuf(in_file, NULL, _IOFBF, 0x8000);
+
                /* Get the time stamp on the input file. */
                if (stat(if_name, &stat_buf) < 0) {
                        error_msg_and_die("Couldn't stat file %s", if_name);
index 5c5bb49f3d095cc7d265e60f9eb24093527b22cd..80dddb226912360e03a9504205a88a8efe9d0cc7 100644 (file)
@@ -568,6 +568,9 @@ char *deb_extract(const char *package_filename, FILE *out_stream,
        /* open the debian package to be worked on */
        deb_stream = wfopen(package_filename, "r");
 
+       /* set the buffer size */
+       setvbuf(deb_stream, NULL, _IOFBF, 0x8000);
+
        /* check ar magic */
        fread(ar_magic, 1, 8, deb_stream);
        if (strncmp(ar_magic,"!<arch>",7) != 0) {
diff --git a/tar.c b/tar.c
index 31443ee22aa7314d2c30922ce0363cf66864eaf4..cf65798fffd6e665e297fcd6d2ebc36954ac3a9b 100644 (file)
--- a/tar.c
+++ b/tar.c
@@ -284,6 +284,10 @@ extern int tar_main(int argc, char **argv)
                /* unzip tarFd in a seperate process */
                if (unzipFlag == TRUE) {
                        comp_file = fdopen(tarFd, "r");
+
+                       /* set the buffer size */
+                       setvbuf(comp_file, NULL, _IOFBF, 0x8000);
+
                        if ((tarFd = fileno(gz_open(comp_file, &pid))) == EXIT_FAILURE) {
                                error_msg_and_die("Couldnt unzip file");
                        }