aboutsummaryrefslogtreecommitdiffstats
path: root/src/w32.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/w32.c')
-rw-r--r--src/w32.c38
1 files changed, 24 insertions, 14 deletions
diff --git a/src/w32.c b/src/w32.c
index e163a3a1ee3..7eaa38716f9 100644
--- a/src/w32.c
+++ b/src/w32.c
@@ -3537,6 +3537,10 @@ is_slow_fs (const char *name)
3537 return !(devtype == DRIVE_FIXED || devtype == DRIVE_RAMDISK); 3537 return !(devtype == DRIVE_FIXED || devtype == DRIVE_RAMDISK);
3538} 3538}
3539 3539
3540/* If this is non-zero, the caller wants accurate information about
3541 file's owner and group, which could be expensive to get. */
3542int w32_stat_get_owner_group;
3543
3540/* MSVC stat function can't cope with UNC names and has other bugs, so 3544/* MSVC stat function can't cope with UNC names and has other bugs, so
3541 replace it with our own. This also allows us to calculate consistent 3545 replace it with our own. This also allows us to calculate consistent
3542 inode values and owner/group without hacks in the main Emacs code. */ 3546 inode values and owner/group without hacks in the main Emacs code. */
@@ -3708,6 +3712,7 @@ stat_worker (const char * path, struct stat * buf, int follow_symlinks)
3708 /* We produce the fallback owner and group data, based on the 3712 /* We produce the fallback owner and group data, based on the
3709 current user that runs Emacs, in the following cases: 3713 current user that runs Emacs, in the following cases:
3710 3714
3715 . caller didn't request owner and group info
3711 . this is Windows 9X 3716 . this is Windows 9X
3712 . getting security by handle failed, and we need to produce 3717 . getting security by handle failed, and we need to produce
3713 information for the target of a symlink (this is better 3718 information for the target of a symlink (this is better
@@ -3716,23 +3721,25 @@ stat_worker (const char * path, struct stat * buf, int follow_symlinks)
3716 3721
3717 If getting security by handle fails, and we don't need to 3722 If getting security by handle fails, and we don't need to
3718 resolve symlinks, we try getting security by name. */ 3723 resolve symlinks, we try getting security by name. */
3719 if (is_windows_9x () != TRUE) 3724 if (!w32_stat_get_owner_group || is_windows_9x () == TRUE)
3720 psd = get_file_security_desc_by_handle (fh);
3721 if (psd)
3722 {
3723 get_file_owner_and_group (psd, name, buf);
3724 LocalFree (psd);
3725 }
3726 else if (is_windows_9x () == TRUE)
3727 get_file_owner_and_group (NULL, name, buf); 3725 get_file_owner_and_group (NULL, name, buf);
3728 else if (!(is_a_symlink && follow_symlinks)) 3726 else
3729 { 3727 {
3730 psd = get_file_security_desc_by_name (name); 3728 psd = get_file_security_desc_by_handle (fh);
3731 get_file_owner_and_group (psd, name, buf); 3729 if (psd)
3732 xfree (psd); 3730 {
3731 get_file_owner_and_group (psd, name, buf);
3732 LocalFree (psd);
3733 }
3734 else if (!(is_a_symlink && follow_symlinks))
3735 {
3736 psd = get_file_security_desc_by_name (name);
3737 get_file_owner_and_group (psd, name, buf);
3738 xfree (psd);
3739 }
3740 else
3741 get_file_owner_and_group (NULL, name, buf);
3733 } 3742 }
3734 else
3735 get_file_owner_and_group (NULL, name, buf);
3736 CloseHandle (fh); 3743 CloseHandle (fh);
3737 } 3744 }
3738 else 3745 else
@@ -6849,6 +6856,9 @@ globals_of_w32 (void)
6849 6856
6850 /* "None" is the default group name on standalone workstations. */ 6857 /* "None" is the default group name on standalone workstations. */
6851 strcpy (dflt_group_name, "None"); 6858 strcpy (dflt_group_name, "None");
6859
6860 /* Reset, in case it has some value inherited from dump time. */
6861 w32_stat_get_owner_group = 0;
6852} 6862}
6853 6863
6854/* For make-serial-process */ 6864/* For make-serial-process */