[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] /srv/bzr/emacs/trunk r111552: Make 'fstat' on MS-Windows b
From: |
Eli Zaretskii |
Subject: |
[Emacs-diffs] /srv/bzr/emacs/trunk r111552: Make 'fstat' on MS-Windows behave more like 'stat' and 'lstat'. |
Date: |
Sat, 19 Jan 2013 09:32:36 +0200 |
User-agent: |
Bazaar (2.5.0) |
------------------------------------------------------------
revno: 111552
committer: Eli Zaretskii <address@hidden>
branch nick: trunk
timestamp: Sat 2013-01-19 09:32:36 +0200
message:
Make 'fstat' on MS-Windows behave more like 'stat' and 'lstat'.
src/w32.c (fstat): Return owner and group like 'stat' and 'lstat' do.
modified:
src/ChangeLog
src/w32.c
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog 2013-01-19 07:13:19 +0000
+++ b/src/ChangeLog 2013-01-19 07:32:36 +0000
@@ -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 <address@hidden>.
+ (fstat): Return owner and group like 'stat' and 'lstat' do.
2013-01-19 Paul Eggert <address@hidden>
=== modified file 'src/w32.c'
--- a/src/w32.c 2013-01-19 07:13:19 +0000
+++ b/src/w32.c 2013-01-19 07:32:36 +0000
@@ -4164,13 +4164,23 @@
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;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] /srv/bzr/emacs/trunk r111552: Make 'fstat' on MS-Windows behave more like 'stat' and 'lstat'.,
Eli Zaretskii <=