[glib: 2/3] W32: consider NTFS mounpoints to be symlinks



commit 075bb0f7511ee83266f823359ad3feec098f2298
Author: Руслан Ижбулатов <lrn1986 gmail com>
Date:   Wed Aug 8 21:42:45 2018 +0000

    W32: consider NTFS mounpoints to be symlinks
    
    While mountpoints are *not* symlinks, strictly speaking,
    they works in a similar enough way, so consider them to be
    symlinks for the purpose of querying local file info.

 gio/glocalfileinfo.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
---
diff --git a/gio/glocalfileinfo.c b/gio/glocalfileinfo.c
index 651992f5b..9cf7ff845 100644
--- a/gio/glocalfileinfo.c
+++ b/gio/glocalfileinfo.c
@@ -961,7 +961,8 @@ set_info_from_stat (GFileInfo             *info,
   else if (S_ISLNK (statbuf->st_mode))
     file_type = G_FILE_TYPE_SYMBOLIC_LINK;
 #elif defined (G_OS_WIN32)
-  if (statbuf->reparse_tag == IO_REPARSE_TAG_SYMLINK)
+  if (statbuf->reparse_tag == IO_REPARSE_TAG_SYMLINK ||
+      statbuf->reparse_tag == IO_REPARSE_TAG_MOUNT_POINT)
     file_type = G_FILE_TYPE_SYMBOLIC_LINK;
 #endif
 
@@ -1808,7 +1809,9 @@ _g_local_file_info_get (const char             *basename,
   is_symlink = stat_ok && S_ISLNK (statbuf.st_mode);
 #elif defined (G_OS_WIN32)
   /* glib already checked the FILE_ATTRIBUTE_REPARSE_POINT for us */
-  is_symlink = stat_ok && statbuf.reparse_tag == IO_REPARSE_TAG_SYMLINK; 
+  is_symlink = stat_ok &&
+      (statbuf.reparse_tag == IO_REPARSE_TAG_SYMLINK ||
+       statbuf.reparse_tag == IO_REPARSE_TAG_MOUNT_POINT);
 #else
   is_symlink = FALSE;
 #endif
@@ -2191,7 +2194,9 @@ set_unix_mode (char                       *filename,
     GWin32PrivateStat statbuf;
 
     res = GLIB_PRIVATE_CALL (g_win32_lstat_utf8) (filename, &statbuf);
-    is_symlink = (res == 0 && statbuf.reparse_tag == IO_REPARSE_TAG_SYMLINK);
+    is_symlink = (res == 0 &&
+                  (statbuf.reparse_tag == IO_REPARSE_TAG_SYMLINK ||
+                   statbuf.reparse_tag == IO_REPARSE_TAG_MOUNT_POINT));
 #endif
     if (is_symlink)
       {


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