[glib/wip/oholy/gfile-docs: 2/3] gfile: Do not follow symlinks when	moving
- From: Ondrej Holy <oholy src gnome org>
- To: commits-list gnome org
- Cc: 
- Subject: [glib/wip/oholy/gfile-docs: 2/3] gfile: Do not follow symlinks when	moving
- Date: Fri,  7 Jun 2019 09:16:55 +0000 (UTC)
commit f17055f5933d3b4e8c14bc4c71aa603ccabb1b35
Author: Ondrej Holy <oholy redhat com>
Date:   Thu Jun 6 16:55:25 2019 +0200
    gfile: Do not follow symlinks when moving
    
    It is expected that `g_file_move()` moves symlink file itself, not its
    target. Unfortunately, copy and delete fallback passes `GFileCopyFlags`
    and don't explicitly use `G_FILE_COPY_NOFOLLOW_SYMLINKS`. This may cause
    that symlink target is copied and symlink itself is removed. Let's
    explicitly pass `G_FILE_COPY_NOFOLLOW_SYMLINKS` to the copy operation to
    prevent this unexpected behavior.
    
    https://gitlab.gnome.org/GNOME/glib/issues/986
 gio/gfile.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/gio/gfile.c b/gio/gfile.c
index 19f5d105f..c9274cd9b 100644
--- a/gio/gfile.c
+++ b/gio/gfile.c
@@ -3736,7 +3736,7 @@ g_file_move (GFile                  *source,
       return FALSE;
     }
 
-  flags |= G_FILE_COPY_ALL_METADATA;
+  flags |= G_FILE_COPY_ALL_METADATA | G_FILE_COPY_NOFOLLOW_SYMLINKS;
   if (!g_file_copy (source, destination, flags, cancellable,
                     progress_callback, progress_callback_data,
                     error))
[
Date Prev][
Date Next]   [
Thread Prev][
Thread Next]   
[
Thread Index]
[
Date Index]
[
Author Index]