[libgsystem] fileutils: Add LIBGSYSTEM_ENABLE_GUESTFS_FUSE_WORKAROUND environment variable



commit b4e8a2ae8684fab55efe74a7fd4b872c934475fd
Author: Colin Walters <walters verbum org>
Date:   Sun Jan 6 06:05:44 2013 -0500

    fileutils: Add LIBGSYSTEM_ENABLE_GUESTFS_FUSE_WORKAROUND environment variable
    
    This ugly hack is necessary because for some reason guestmount/fuse gives
    me ENOENT, when it should be returning EXDEV.

 gsystem-file-utils.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
---
diff --git a/gsystem-file-utils.c b/gsystem-file-utils.c
index 93a3d68..6d53a6b 100644
--- a/gsystem-file-utils.c
+++ b/gsystem-file-utils.c
@@ -310,10 +310,13 @@ gs_file_linkcopy_sync_data (GFile          *src,
 {
   gboolean ret = FALSE;
   int i;
+  gboolean enable_guestfs_fuse_workaround;
   gs_unref_object GFile *dest_parent = NULL;
 
   dest_parent = g_file_get_parent (dest);
 
+  enable_guestfs_fuse_workaround = getenv ("LIBGSYSTEM_ENABLE_GUESTFS_FUSE_WORKAROUND") != NULL;
+
   /* 128 attempts seems reasonable... */
   for (i = 0; i < 128; i++)
     {
@@ -332,7 +335,8 @@ gs_file_linkcopy_sync_data (GFile          *src,
         {
           if (errno == EEXIST)
             continue;
-          else if (errno == EXDEV || errno == EMLINK || errno == EPERM)
+          else if (errno == EXDEV || errno == EMLINK || errno == EPERM
+                   || (enable_guestfs_fuse_workaround && errno == ENOENT))
             {
               if (!g_file_copy (src, tmp_dest,
                                 G_FILE_COPY_OVERWRITE | G_FILE_COPY_ALL_METADATA | G_FILE_COPY_NOFOLLOW_SYMLINKS,



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]