svn commit: r207790 - head/usr.bin/tar

Anonymous swell.k at gmail.com
Sat May 22 20:24:59 UTC 2010


Tim Kientzle <kientzle at freebsd.org> writes:

> Ah, yes.  I did forget to add an EINTR check to the write side.
>
> Attached patch should fix "tar cf"
>
> Thanks for your careful testing...
>
[...]
> Index: archive_write.c
> ===================================================================
> --- archive_write.c	(revision 2413)
> +++ archive_write.c	(working copy)
> @@ -361,11 +361,20 @@
>                  remaining -= to_copy;
>                  /* ... if it's full, write it out. */
>                  if (state->avail == 0) {
> -                        bytes_written = (a->client_writer)(&a->archive,
> -                            a->client_data, state->buffer, state->buffer_size);
> -                        if (bytes_written <= 0)
> -                                return (ARCHIVE_FATAL);
> -                        /* XXX TODO: if bytes_written < state->buffer_size */
> +			char *p = state->buffer;
> +			size_t remaining = state->buffer_size;
> +			while (remaining > 0) {
> +				bytes_written = (a->client_writer)(&a->archive,
> +				    a->client_data, p, remaining);
> +				if (bytes_written <= 0)
> +					return (ARCHIVE_FATAL);
> +				if (bytes_remaining > remaining) {
> +					archive_set_error(a, -1, "write overrun");
> +					return (ARCHIVE_FATAL);
> +				}
> +				p += bytes_written;
> +				remaining -= bytes_written;
> +			}
>                          state->next = state->buffer;
>                          state->avail = state->buffer_size;
>                  }

This hunk doesn't apply against archive_write.c at r201099. It depends on
r1936 from googlecode that wasn't merged to /head.

I compiled without the above hunk and I no longer able to reproduce the
issue. Thanks.


More information about the svn-src-head mailing list