]> Dogcows Code - chaz/tar/commitdiff
Do not pad compressed output if it goes to stdout.
authorSergey Poznyakoff <gray@gnu.org.ua>
Thu, 10 Nov 2005 12:59:25 +0000 (12:59 +0000)
committerSergey Poznyakoff <gray@gnu.org.ua>
Thu, 10 Nov 2005 12:59:25 +0000 (12:59 +0000)
src/system.c

index 05313db88a9190297ecd0ca90f9a0f742617c8c2..99cb0f33146414d62ef8dd4f20e07319e44c7ae6 100644 (file)
@@ -332,12 +332,10 @@ sys_child_open_for_compress (void)
   xclose (parent_pipe[PWRITE]);
 
   /* Check if we need a grandchild tar.  This happens only if either:
-     a) we are writing stdout: to force reblocking;
-     b) the file is to be accessed by rmt: compressor doesn't know how;
-     c) the file is not a plain file.  */
+     a) the file is to be accessed by rmt: compressor doesn't know how;
+     b) the file is not a plain file.  */
 
-  if (strcmp (archive_name_array[0], "-") != 0
-      && !_remdev (archive_name_array[0])
+  if (!_remdev (archive_name_array[0])
       && is_regular_file (archive_name_array[0]))
     {
       if (backup_option)
@@ -345,20 +343,21 @@ sys_child_open_for_compress (void)
 
       /* We don't need a grandchild tar.  Open the archive and launch the
         compressor.  */
-
-      archive = creat (archive_name_array[0], MODE_RW);
-      if (archive < 0)
+      if (strcmp (archive_name_array[0], "-"))
        {
-         int saved_errno = errno;
-
-         if (backup_option)
-           undo_last_backup ();
-         errno = saved_errno;
-         open_fatal (archive_name_array[0]);
+         archive = creat (archive_name_array[0], MODE_RW);
+         if (archive < 0)
+           {
+             int saved_errno = errno;
+             
+             if (backup_option)
+               undo_last_backup ();
+             errno = saved_errno;
+             open_fatal (archive_name_array[0]);
+           }
+         xdup2 (archive, STDOUT_FILENO);
        }
-      xdup2 (archive, STDOUT_FILENO);
-      execlp (use_compress_program_option, use_compress_program_option,
-             (char *) 0);
+      execlp (use_compress_program_option, use_compress_program_option, NULL);
       exec_fatal (use_compress_program_option);
     }
 
This page took 0.026845 seconds and 4 git commands to generate.