From 0fb0fb8391f2e78177585c8e4842d0fce79e4408 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Fri, 17 Jul 2009 09:00:19 +0000 Subject: * globals.cc: Improve comment on R/O UNICODE_STRINGs. * mount.h (class fs_info): Add is_mvfs bit. * mount.cc (fs_info::update): Recognize MVFS remote filesystem. (fillout_mntent): Reorder filesystem checks for speed. Add mvfs, unixfs, and sunwnfs filesystem types. * path.h (class path_conv): Add fs_is_mvfs method. * path.cc (symlink_worker): On MVFS, always create symlinks as Windows shortcuts. Explain why. --- winsup/cygwin/path.cc | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'winsup/cygwin/path.cc') diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc index 20d750303..bd9b90ae9 100644 --- a/winsup/cygwin/path.cc +++ b/winsup/cygwin/path.cc @@ -1367,6 +1367,7 @@ symlink_worker (const char *oldpath, const char *newpath, bool use_winsym, HANDLE fh; tmp_pathbuf tp; unsigned check_opt; + bool mk_winsym = use_winsym; /* POSIX says that empty 'newpath' is invalid input while empty 'oldpath' is valid -- it's symlink resolver job to verify if @@ -1397,7 +1398,11 @@ symlink_worker (const char *oldpath, const char *newpath, bool use_winsym, check_opt = PC_SYM_NOFOLLOW | PC_POSIX | (isdevice ? PC_NOWARN : 0); /* We need the normalized full path below. */ win32_newpath.check (newpath, check_opt, stat_suffixes); - if (use_winsym && !win32_newpath.exists () + /* MVFS doesn't handle the SYSTEM DOS attribute, but it handles the R/O + attribute. Therefore we create symlinks on MVFS always as shortcuts. */ + mk_winsym |= win32_newpath.fs_is_mvfs (); + + if (mk_winsym && !win32_newpath.exists () && (isdevice || !win32_newpath.fs_is_nfs ())) { char *newplnk = tp.c_get (); @@ -1449,7 +1454,7 @@ symlink_worker (const char *oldpath, const char *newpath, bool use_winsym, goto done; } - if (use_winsym) + if (mk_winsym) { ITEMIDLIST *pidl = NULL; size_t full_len = 0; @@ -1634,8 +1639,8 @@ symlink_worker (const char *oldpath, const char *newpath, bool use_winsym, status = NtWriteFile (fh, NULL, NULL, NULL, &io, buf, cp - buf, NULL, NULL); if (NT_SUCCESS (status) && io.Information == (ULONG) (cp - buf)) { - status = NtSetAttributesFile (fh, use_winsym ? FILE_ATTRIBUTE_READONLY - : FILE_ATTRIBUTE_SYSTEM); + status = NtSetAttributesFile (fh, mk_winsym ? FILE_ATTRIBUTE_READONLY + : FILE_ATTRIBUTE_SYSTEM); if (!NT_SUCCESS (status)) debug_printf ("Setting attributes failed, status = %p", status); res = 0; @@ -1653,7 +1658,7 @@ symlink_worker (const char *oldpath, const char *newpath, bool use_winsym, done: syscall_printf ("%d = symlink_worker (%s, %s, %d, %d)", res, oldpath, - newpath, use_winsym, isdevice); + newpath, mk_winsym, isdevice); return res; } -- cgit v1.2.3