diff options
| author | Joakim Verona | 2012-12-14 15:12:27 +0100 |
|---|---|---|
| committer | Joakim Verona | 2012-12-14 15:12:27 +0100 |
| commit | bb099166ee76931d2018d337098fd6814bd55e5d (patch) | |
| tree | be16ebdc7acbc5549c3df02b8c88c96131e0afaa /src | |
| parent | 86c87c05b650cac7d163e97f538642f4dffd2a9c (diff) | |
| parent | 5c207910c4899af1c547b0e508692d846c145d48 (diff) | |
| download | emacs-bb099166ee76931d2018d337098fd6814bd55e5d.tar.gz emacs-bb099166ee76931d2018d337098fd6814bd55e5d.zip | |
auto upstream
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 11 | ||||
| -rw-r--r-- | src/dired.c | 17 | ||||
| -rw-r--r-- | src/w32.c | 38 |
3 files changed, 51 insertions, 15 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index c64416a6454..a1dc1c2adab 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,14 @@ | |||
| 1 | 2012-12-14 Eli Zaretskii <eliz@gnu.org> | ||
| 2 | |||
| 3 | * w32.c (stat_worker): If w32_stat_get_owner_group is zero, do not | ||
| 4 | try to get accurate owner and group information from NT file | ||
| 5 | security APIs. This is to make most callers of 'stat' and | ||
| 6 | 'lstat', which don't need that information, much faster. | ||
| 7 | |||
| 8 | * dired.c (Ffile_attributes) [WINDOWSNT]: Set | ||
| 9 | w32_stat_get_owner_group to a non-zero value, to request accurate | ||
| 10 | owner and group information from 'lstat'. | ||
| 11 | |||
| 1 | 2012-12-13 Paul Eggert <eggert@cs.ucla.edu> | 12 | 2012-12-13 Paul Eggert <eggert@cs.ucla.edu> |
| 2 | 13 | ||
| 3 | * fileio.c (Finsert_file_contents): Don't put tail into head area, | 14 | * fileio.c (Finsert_file_contents): Don't put tail into head area, |
diff --git a/src/dired.c b/src/dired.c index bdb71c46364..85af906c1da 100644 --- a/src/dired.c +++ b/src/dired.c | |||
| @@ -895,6 +895,7 @@ so last access time will always be midnight of that day. */) | |||
| 895 | Lisp_Object dirname; | 895 | Lisp_Object dirname; |
| 896 | struct stat sdir; | 896 | struct stat sdir; |
| 897 | #endif /* BSD4_2 */ | 897 | #endif /* BSD4_2 */ |
| 898 | int lstat_result; | ||
| 898 | 899 | ||
| 899 | /* An array to hold the mode string generated by filemodestring, | 900 | /* An array to hold the mode string generated by filemodestring, |
| 900 | including its terminating space and null byte. */ | 901 | including its terminating space and null byte. */ |
| @@ -922,7 +923,21 @@ so last access time will always be midnight of that day. */) | |||
| 922 | encoded = ENCODE_FILE (filename); | 923 | encoded = ENCODE_FILE (filename); |
| 923 | UNGCPRO; | 924 | UNGCPRO; |
| 924 | 925 | ||
| 925 | if (lstat (SSDATA (encoded), &s) < 0) | 926 | #ifdef WINDOWSNT |
| 927 | /* We usually don't request accurate owner and group info, because | ||
| 928 | it can be very expensive on Windows to get that, and most callers | ||
| 929 | of 'lstat' don't need that. But here we do want that information | ||
| 930 | to be accurate. */ | ||
| 931 | w32_stat_get_owner_group = 1; | ||
| 932 | #endif | ||
| 933 | |||
| 934 | lstat_result = lstat (SSDATA (encoded), &s); | ||
| 935 | |||
| 936 | #ifdef WINDOWSNT | ||
| 937 | w32_stat_get_owner_group = 0; | ||
| 938 | #endif | ||
| 939 | |||
| 940 | if (lstat_result < 0) | ||
| 926 | return Qnil; | 941 | return Qnil; |
| 927 | 942 | ||
| 928 | values[0] = (S_ISLNK (s.st_mode) ? Ffile_symlink_p (filename) | 943 | values[0] = (S_ISLNK (s.st_mode) ? Ffile_symlink_p (filename) |
| @@ -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. */ | ||
| 3542 | int 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 */ |