source: patches/tar-1.21-revert_pipe_drain-1.patch@ 29a9276

clfs-1.2 clfs-2.1 clfs-3.0.0-systemd clfs-3.0.0-sysvinit systemd sysvinit
Last change on this file since 29a9276 was bf56c25, checked in by Jim Gifford <clfs@…>, 16 years ago

Added Revert Pipe Drain Patch to Tar

  • Property mode set to 100644
File size: 3.2 KB
  • src/buffer.c

    Submitted By: Jim Gifford (jim at cross-lfs dot org)
    Date: 2009-01-04
    Initial Package Version: 1.21
    Origin: Tar Bug List
    Upstream Status: Applied
    Description: http://lists.gnu.org/archive/html/bug-tar/2008-12/msg00028.html
    
    diff -Naur tar-1.21.orig/src/buffer.c tar-1.21/src/buffer.c
    old new  
    848848        flush_archive ();
    849849    }
    850850
     851  sys_drain_input_pipe ();
     852
    851853  compute_duration ();
    852854  if (verify_option)
    853855    verify_volume ();
     
    855857  if (rmtclose (archive) != 0)
    856858    close_error (*archive_name_cursor);
    857859
    858   sys_wait_for_child (child_pid, hit_eof);
     860  sys_wait_for_child (child_pid);
    859861
    860862  tar_stat_destroy (&current_stat_info);
    861863  if (save_name)
  • src/common.h

    diff -Naur tar-1.21.orig/src/common.h tar-1.21/src/common.h
    old new  
    699699
    700700void sys_detect_dev_null_output (void);
    701701void sys_save_archive_dev_ino (void);
    702 void sys_wait_for_child (pid_t, bool);
     702void sys_drain_input_pipe (void);
     703void sys_wait_for_child (pid_t);
    703704void sys_spawn_shell (void);
    704705bool sys_compare_uid (struct stat *a, struct stat *b);
    705706bool sys_compare_gid (struct stat *a, struct stat *b);
  • src/system.c

    diff -Naur tar-1.21.orig/src/system.c tar-1.21/src/system.c
    old new  
    11/* System-dependent calls for tar.
    22
    3    Copyright (C) 2003, 2004, 2005, 2006, 2007,
    4    2008 Free Software Foundation, Inc.
     3   Copyright (C) 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
    54
    65   This program is free software; you can redistribute it and/or modify it
    76   under the terms of the GNU General Public License as published by the
     
    5251}
    5352
    5453void
    55 sys_wait_for_child (pid_t child_pid, bool eof)
     54sys_drain_input_pipe (void)
     55{
     56}
     57
     58void
     59sys_wait_for_child (pid_t child_pid)
    5660{
    5761}
    5862
     
    156160                         && archive_stat.st_ino == dev_null_stat.st_ino));
    157161}
    158162
     163/* Manage to fully drain a pipe we might be reading, so to not break it on
     164   the producer after the EOF block.  FIXME: one of these days, GNU tar
     165   might become clever enough to just stop working, once there is no more
     166   work to do, we might have to revise this area in such time.  */
     167
     168void
     169sys_drain_input_pipe (void)
     170{
     171  size_t r;
     172
     173  if (access_mode == ACCESS_READ
     174      && ! _isrmt (archive)
     175      && (S_ISFIFO (archive_stat.st_mode) || S_ISSOCK (archive_stat.st_mode)))
     176    while ((r = rmtread (archive, record_start->buffer, record_size)) != 0
     177           && r != SAFE_READ_ERROR)
     178      continue;
     179}
     180
    159181void
    160 sys_wait_for_child (pid_t child_pid, bool eof)
     182sys_wait_for_child (pid_t child_pid)
    161183{
    162184  if (child_pid)
    163185    {
     
    171193          }
    172194
    173195      if (WIFSIGNALED (wait_status))
    174         {
    175           int sig = WTERMSIG (wait_status);
    176           if (!(!eof && sig == SIGPIPE))
    177             ERROR ((0, 0, _("Child died with signal %d"), sig));
    178         }
     196        ERROR ((0, 0, _("Child died with signal %d"),
     197                WTERMSIG (wait_status)));
    179198      else if (WEXITSTATUS (wait_status) != 0)
    180199        ERROR ((0, 0, _("Child returned status %d"),
    181200                WEXITSTATUS (wait_status)));
Note: See TracBrowser for help on using the repository browser.