diff options
| author | Eli Zaretskii | 2013-01-19 09:32:36 +0200 |
|---|---|---|
| committer | Eli Zaretskii | 2013-01-19 09:32:36 +0200 |
| commit | 76e9f7b9a1fbcf3d5087a441ff61ab7a36e624b5 (patch) | |
| tree | 6a81a468884df94c8efedee99ff369e446e181a8 /src | |
| parent | 6a9465f387f1933e2ff9d9258c87a44af58bd34f (diff) | |
| download | emacs-76e9f7b9a1fbcf3d5087a441ff61ab7a36e624b5.tar.gz emacs-76e9f7b9a1fbcf3d5087a441ff61ab7a36e624b5.zip | |
Make 'fstat' on MS-Windows behave more like 'stat' and 'lstat'.
src/w32.c (fstat): Return owner and group like 'stat' and 'lstat' do.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 1 | ||||
| -rw-r--r-- | src/w32.c | 24 |
2 files changed, 18 insertions, 7 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 26773878753..3727e13d580 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -3,6 +3,7 @@ | |||
| 3 | * w32.c (acl_set_file): Treat ERROR_ACCESS_DENIED from | 3 | * w32.c (acl_set_file): Treat ERROR_ACCESS_DENIED from |
| 4 | set_file_security as failure due to insufficient privileges. | 4 | set_file_security as failure due to insufficient privileges. |
| 5 | Reported by Fabrice Popineau <fabrice.popineau@supelec.fr>. | 5 | Reported by Fabrice Popineau <fabrice.popineau@supelec.fr>. |
| 6 | (fstat): Return owner and group like 'stat' and 'lstat' do. | ||
| 6 | 7 | ||
| 7 | 2013-01-19 Paul Eggert <eggert@cs.ucla.edu> | 8 | 2013-01-19 Paul Eggert <eggert@cs.ucla.edu> |
| 8 | 9 | ||
| @@ -4164,13 +4164,23 @@ fstat (int desc, struct stat * buf) | |||
| 4164 | else | 4164 | else |
| 4165 | buf->st_ino = fake_inode; | 4165 | buf->st_ino = fake_inode; |
| 4166 | 4166 | ||
| 4167 | /* Consider files to belong to current user. | 4167 | /* If the caller so requested, get the true file owner and group. |
| 4168 | FIXME: this should use GetSecurityInfo API, but it is only | 4168 | Otherwise, consider the file to belong to the current user. */ |
| 4169 | available for _WIN32_WINNT >= 0x501. */ | 4169 | if (!w32_stat_get_owner_group || is_windows_9x () == TRUE) |
| 4170 | buf->st_uid = dflt_passwd.pw_uid; | 4170 | get_file_owner_and_group (NULL, buf); |
| 4171 | buf->st_gid = dflt_passwd.pw_gid; | 4171 | else |
| 4172 | strcpy (buf->st_uname, dflt_passwd.pw_name); | 4172 | { |
| 4173 | strcpy (buf->st_gname, dflt_group.gr_name); | 4173 | PSECURITY_DESCRIPTOR psd = NULL; |
| 4174 | |||
| 4175 | psd = get_file_security_desc_by_handle (fh); | ||
| 4176 | if (psd) | ||
| 4177 | { | ||
| 4178 | get_file_owner_and_group (psd, buf); | ||
| 4179 | LocalFree (psd); | ||
| 4180 | } | ||
| 4181 | else | ||
| 4182 | get_file_owner_and_group (NULL, buf); | ||
| 4183 | } | ||
| 4174 | 4184 | ||
| 4175 | buf->st_dev = info.dwVolumeSerialNumber; | 4185 | buf->st_dev = info.dwVolumeSerialNumber; |
| 4176 | buf->st_rdev = info.dwVolumeSerialNumber; | 4186 | buf->st_rdev = info.dwVolumeSerialNumber; |