Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 252680
Collapse All | Expand All

(-)a/src/buffer.c (-1 / +3 lines)
Lines 848-853 close_archive (void) Link Here
848
        flush_archive ();
848
        flush_archive ();
849
    }
849
    }
850
850
851
  sys_drain_input_pipe ();
852
851
  compute_duration ();
853
  compute_duration ();
852
  if (verify_option)
854
  if (verify_option)
853
    verify_volume ();
855
    verify_volume ();
Lines 855-861 close_archive (void) Link Here
855
  if (rmtclose (archive) != 0)
857
  if (rmtclose (archive) != 0)
856
    close_error (*archive_name_cursor);
858
    close_error (*archive_name_cursor);
857
859
858
  sys_wait_for_child (child_pid, hit_eof);
860
  sys_wait_for_child (child_pid);
859
861
860
  tar_stat_destroy (&current_stat_info);
862
  tar_stat_destroy (&current_stat_info);
861
  if (save_name)
863
  if (save_name)
(-)a/src/common.h (-1 / +2 lines)
Lines 699-705 char *xheader_format_name (struct tar_stat_info *st, const char *fmt, Link Here
699
699
700
void sys_detect_dev_null_output (void);
700
void sys_detect_dev_null_output (void);
701
void sys_save_archive_dev_ino (void);
701
void sys_save_archive_dev_ino (void);
702
void sys_wait_for_child (pid_t, bool);
702
void sys_drain_input_pipe (void);
703
void sys_wait_for_child (pid_t);
703
void sys_spawn_shell (void);
704
void sys_spawn_shell (void);
704
bool sys_compare_uid (struct stat *a, struct stat *b);
705
bool sys_compare_uid (struct stat *a, struct stat *b);
705
bool sys_compare_gid (struct stat *a, struct stat *b);
706
bool sys_compare_gid (struct stat *a, struct stat *b);
(-)a/src/system.c (-9 / +28 lines)
Lines 1-7 Link Here
1
/* System-dependent calls for tar.
1
/* System-dependent calls for tar.
2
2
3
   Copyright (C) 2003, 2004, 2005, 2006, 2007,
3
   Copyright (C) 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
4
   2008 Free Software Foundation, Inc.
5
4
6
   This program is free software; you can redistribute it and/or modify it
5
   This program is free software; you can redistribute it and/or modify it
7
   under the terms of the GNU General Public License as published by the
6
   under the terms of the GNU General Public License as published by the
Lines 52-58 sys_detect_dev_null_output (void) Link Here
52
}
51
}
53
52
54
void
53
void
55
sys_wait_for_child (pid_t child_pid, bool eof)
54
sys_drain_input_pipe (void)
55
{
56
}
57
58
void
59
sys_wait_for_child (pid_t child_pid)
56
{
60
{
57
}
61
}
58
62
Lines 156-163 sys_detect_dev_null_output (void) Link Here
156
			 && archive_stat.st_ino == dev_null_stat.st_ino));
160
			 && archive_stat.st_ino == dev_null_stat.st_ino));
157
}
161
}
158
162
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
168
void
169
sys_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
159
void
181
void
160
sys_wait_for_child (pid_t child_pid, bool eof)
182
sys_wait_for_child (pid_t child_pid)
161
{
183
{
162
  if (child_pid)
184
  if (child_pid)
163
    {
185
    {
Lines 171-181 sys_wait_for_child (pid_t child_pid, bool eof) Link Here
171
	  }
193
	  }
172
194
173
      if (WIFSIGNALED (wait_status))
195
      if (WIFSIGNALED (wait_status))
174
	{
196
	ERROR ((0, 0, _("Child died with signal %d"),
175
	  int sig = WTERMSIG (wait_status);
197
		WTERMSIG (wait_status)));
176
	  if (!(!eof && sig == SIGPIPE))
177
	    ERROR ((0, 0, _("Child died with signal %d"), sig));
178
	}
179
      else if (WEXITSTATUS (wait_status) != 0)
198
      else if (WEXITSTATUS (wait_status) != 0)
180
	ERROR ((0, 0, _("Child returned status %d"),
199
	ERROR ((0, 0, _("Child returned status %d"),
181
		WEXITSTATUS (wait_status)));
200
		WEXITSTATUS (wait_status)));

Return to bug 252680