Syncronise some build files with busybox-cvs-20030819
[oweals/busybox.git] / archival / tar.c
index 06851e854aee6978dd346dabe9773d761112f5a9..2f0c83b27e9823c68bf6b558b95b9972f5e47e3b 100644 (file)
@@ -9,8 +9,7 @@
  * ground up.  It still has remnents of the old code lying about, but it is
  * very different now (i.e., cleaner, less global variables, etc.)
  *
- * Copyright (C) 1999,2000 by Lineo, inc. and Erik Andersen
- * Copyright (C) 1999-2002 by Erik Andersen <andersee@debian.org>
+ * Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
  *
  * Based in part in the tar implementation in sash
  *  Copyright (c) 1999 by David I. Bell
@@ -526,7 +525,7 @@ static inline int writeTarFile(const char *tarName, const int verboseFlag,
                        while (1) {
                                char buf;
 
-                               int n = read(gzipStatusPipe[0], &buf, 1);
+                               int n = bb_full_read(gzipStatusPipe[0], &buf, 1);
 
                                if (n == 0 && vfork_exec_errno != 0) {
                                        errno = vfork_exec_errno;
@@ -675,7 +674,8 @@ int tar_main(int argc, char **argv)
        }
        if(opt & TAR_OPT_VERBOSE) {
                        if ((tar_handle->action_header == header_list) || 
-                               (tar_handle->action_header == header_verbose_list)) {
+                               (tar_handle->action_header == header_verbose_list)) 
+                       {
                                tar_handle->action_header = header_verbose_list;
                        } else {
                                tar_handle->action_header = header_list;
@@ -687,7 +687,7 @@ int tar_main(int argc, char **argv)
        }
 #endif
 #ifdef CONFIG_FEATURE_TAR_BZIP2
-       if(opt & TAR_OPT_GZIP) {
+       if(opt & TAR_OPT_BZIP2) {
                        get_header_ptr = get_header_tar_bz2;
        }
 #endif
@@ -724,8 +724,14 @@ int tar_main(int argc, char **argv)
                        gzipFlag = TRUE;
                }
 # endif /* CONFIG_FEATURE_TAR_GZIP */
+# ifdef CONFIG_FEATURE_TAR_BZIP2
+               if (get_header_ptr == get_header_tar_bz2) {
+                       bb_error_msg_and_die("Creating bzip2 compressed archives is not currently supported.");
+               }
+# endif /* CONFIG_FEATURE_TAR_BZIP2 */
 
-               if (tar_handle->action_header == header_verbose_list) {
+               if ((tar_handle->action_header == header_list) || 
+                               (tar_handle->action_header == header_verbose_list)) {
                        verboseFlag = TRUE;
                }
                writeTarFile(tar_filename, verboseFlag, tar_handle->accept,