On Mon, 2016-09-12 at 18:59 +0200, Greg Kroah-Hartman wrote:
> 4.4-stable review patch.  If anyone has any objections, please let me know.
> 
> ------------------
> 
> [ Upstream commit b4ed5d1682c6613988c2eb1de55df5ac9988afcc ]
> 
> Currently some "Unspecified error 0x80004005" is reported on the Windows
> side if something fails. Handle the ENOSPC case and return
> ERROR_DISK_FULL, which allows at least Copy-VMFile to report a meaning
> full error.
[...]
> @@ -98,14 +100,26 @@ done:
>  static int hv_copy_data(struct hv_do_fcopy *cpmsg)
>  {
>       ssize_t bytes_written;
> +     int ret = 0;
>  
>       bytes_written = pwrite(target_fd, cpmsg->data, cpmsg->size,
>                               cpmsg->offset);
>  
> -     if (bytes_written != cpmsg->size)
> -             return HV_E_FAIL;
> +     filesize += cpmsg->size;
> +     if (bytes_written != cpmsg->size) {
> +             switch (errno) {
[...]

If pwrite() returns a non-negative value less than the requested size,
errno is undefined.  You need to keep trying to write the remaining
bytes until it returns -1.

Ben.

-- 
Ben Hutchings
Software Developer, Codethink Ltd.


Reply via email to