aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEli Zaretskii2013-01-19 09:32:36 +0200
committerEli Zaretskii2013-01-19 09:32:36 +0200
commit76e9f7b9a1fbcf3d5087a441ff61ab7a36e624b5 (patch)
tree6a81a468884df94c8efedee99ff369e446e181a8 /src
parent6a9465f387f1933e2ff9d9258c87a44af58bd34f (diff)
downloademacs-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/ChangeLog1
-rw-r--r--src/w32.c24
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
72013-01-19 Paul Eggert <eggert@cs.ucla.edu> 82013-01-19 Paul Eggert <eggert@cs.ucla.edu>
8 9
diff --git a/src/w32.c b/src/w32.c
index 525b0a8e89b..be58dc5cd53 100644
--- a/src/w32.c
+++ b/src/w32.c
@@ -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;