Index: thunar-vfs/thunar-vfs-io-local-xfer.c =================================================================== --- thunar-vfs/thunar-vfs-io-local-xfer.c (revision 28910) +++ thunar-vfs/thunar-vfs-io-local-xfer.c (working copy) @@ -252,6 +252,25 @@ else #endif /* !HAVE_MMAP */ { + /* we try to set the file offset of the target to the file size of + * the source. if this fails write is not going to work for us. */ + if (lseek (target_fd, source_statb->st_size, SEEK_SET) < 0) + { + /* assume EINVAL means offset beyond the end of a seekable device, + * ie. file is too big for the filesystem */ + if (G_LIKELY (errno == EINVAL)) + errno = EFBIG; + +end4: + tvilx_set_error_with_path (error, _("Failed to write data to \"%s\""), target_absolute_path); + goto end3; + } + else if (lseek (target_fd, 0, SEEK_SET) < 0) + { + /* this will probably never happen, but if so, return a nice error */ + goto end4; + } + #ifdef HAVE_POSIX_FADVISE /* tell the system that the data will be read sequentially */ posix_fadvise (source_fd, 0, 0, POSIX_FADV_SEQUENTIAL); @@ -330,6 +349,7 @@ futimes (target_fd, times); #endif +end3: /* close the file descriptors */ close (target_fd); end1: