Commit 76e9f7b9 authored by Eli Zaretskii's avatar Eli Zaretskii
Browse files

Make 'fstat' on MS-Windows behave more like 'stat' and 'lstat'.

 src/w32.c (fstat): Return owner and group like 'stat' and 'lstat' do.
parent 6a9465f3
......@@ -3,6 +3,7 @@
* w32.c (acl_set_file): Treat ERROR_ACCESS_DENIED from
set_file_security as failure due to insufficient privileges.
Reported by Fabrice Popineau <fabrice.popineau@supelec.fr>.
(fstat): Return owner and group like 'stat' and 'lstat' do.
 
2013-01-19 Paul Eggert <eggert@cs.ucla.edu>
 
......
......@@ -4164,13 +4164,23 @@ fstat (int desc, struct stat * buf)
else
buf->st_ino = fake_inode;
/* Consider files to belong to current user.
FIXME: this should use GetSecurityInfo API, but it is only
available for _WIN32_WINNT >= 0x501. */
buf->st_uid = dflt_passwd.pw_uid;
buf->st_gid = dflt_passwd.pw_gid;
strcpy (buf->st_uname, dflt_passwd.pw_name);
strcpy (buf->st_gname, dflt_group.gr_name);
/* If the caller so requested, get the true file owner and group.
Otherwise, consider the file to belong to the current user. */
if (!w32_stat_get_owner_group || is_windows_9x () == TRUE)
get_file_owner_and_group (NULL, buf);
else
{
PSECURITY_DESCRIPTOR psd = NULL;
psd = get_file_security_desc_by_handle (fh);
if (psd)
{
get_file_owner_and_group (psd, buf);
LocalFree (psd);
}
else
get_file_owner_and_group (NULL, buf);
}
buf->st_dev = info.dwVolumeSerialNumber;
buf->st_rdev = info.dwVolumeSerialNumber;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment