Tim Kientzle <kient...@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_writ...@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.
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to