[ostree] Don't fail for EPERM when hardlinking



commit 1057f8289ce5769f9d32cf05efbb6d00406e71a7
Author: Giovanni Campagna <gcampagna src gnome org>
Date:   Mon Aug 20 22:32:17 2012 +0200

    Don't fail for EPERM when hardlinking
    
    As the manual page doesn't say, but the in-code kernel documentation
    shows, hardlinking for normal users can fail for a variety of
    reasons (including very common situations such as non regular file
    or non writable file), if the owner of the file does not match
    the user linking (e.g. when checking out a shadow repo with a root-
    owned master).
    If that happens, fail back silently to copying instead of aborting
    the whole operation.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=682298

 src/libostree/ostree-repo.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/src/libostree/ostree-repo.c b/src/libostree/ostree-repo.c
index 8878113..200a790 100644
--- a/src/libostree/ostree-repo.c
+++ b/src/libostree/ostree-repo.c
@@ -4125,9 +4125,9 @@ checkout_file_hardlink (OstreeRepo                  *self,
 
   if (link (ot_gfile_get_path_cached (source), ot_gfile_get_path_cached (destination)) != -1)
     ret_was_supported = TRUE;
-  else if (errno == EMLINK || errno == EXDEV)
+  else if (errno == EMLINK || errno == EXDEV || errno == EPERM)
     {
-      /* EMLINK and EXDEV shouldn't be fatal; we just can't do the
+      /* EMLINK, EXDEV and EPERM shouldn't be fatal; we just can't do the
        * optimization of hardlinking instead of copying.
        */
       ret_was_supported = FALSE;



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