[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] /srv/bzr/emacs/trunk r111578: Another minor fix in acl_set
From: |
Eli Zaretskii |
Subject: |
[Emacs-diffs] /srv/bzr/emacs/trunk r111578: Another minor fix in acl_set_file on Windows. |
Date: |
Mon, 21 Jan 2013 20:00:19 +0200 |
User-agent: |
Bazaar (2.5.0) |
------------------------------------------------------------
revno: 111578
committer: Eli Zaretskii <address@hidden>
branch nick: trunk
timestamp: Mon 2013-01-21 20:00:19 +0200
message:
Another minor fix in acl_set_file on Windows.
src/w32.c (acl_set_file): Don't test for errors unless
set_file_security returns FALSE. Avoids spurious errors when
saving files.
modified:
src/ChangeLog
src/w32.c
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog 2013-01-21 17:01:09 +0000
+++ b/src/ChangeLog 2013-01-21 18:00:19 +0000
@@ -1,3 +1,9 @@
+2013-01-21 Eli Zaretskii <address@hidden>
+
+ * w32.c (acl_set_file): Don't test for errors unless
+ set_file_security returns FALSE. Avoids spurious errors when
+ saving files.
+
2013-01-21 Dmitry Antipov <address@hidden>
* fileio.c (Finsert_file_contents): Revert code introduced at
=== modified file 'src/w32.c'
--- a/src/w32.c 2013-01-19 07:32:36 +0000
+++ b/src/w32.c 2013-01-21 18:00:19 +0000
@@ -4868,8 +4868,50 @@
e = errno;
errno = 0;
- set_file_security ((char *)fname, flags, (PSECURITY_DESCRIPTOR)acl);
- err = GetLastError ();
+ if (!set_file_security ((char *)fname, flags, (PSECURITY_DESCRIPTOR)acl))
+ {
+ err = GetLastError ();
+
+ if (errno == ENOTSUP)
+ ;
+ else if (err == ERROR_INVALID_OWNER
+ || err == ERROR_NOT_ALL_ASSIGNED
+ || err == ERROR_ACCESS_DENIED)
+ {
+ /* Maybe the requested ACL and the one the file already has
+ are identical, in which case we can silently ignore the
+ failure. (And no, Windows doesn't.) */
+ acl_t current_acl = acl_get_file (fname, ACL_TYPE_ACCESS);
+
+ errno = EPERM;
+ if (current_acl)
+ {
+ char *acl_from = acl_to_text (current_acl, NULL);
+ char *acl_to = acl_to_text (acl, NULL);
+
+ if (acl_from && acl_to && xstrcasecmp (acl_from, acl_to) == 0)
+ {
+ retval = 0;
+ errno = e;
+ }
+ if (acl_from)
+ acl_free (acl_from);
+ if (acl_to)
+ acl_free (acl_to);
+ acl_free (current_acl);
+ }
+ }
+ else if (err == ERROR_FILE_NOT_FOUND || err == ERROR_PATH_NOT_FOUND)
+ errno = ENOENT;
+ else
+ errno = EACCES;
+ }
+ else
+ {
+ retval = 0;
+ errno = e;
+ }
+
if (st)
{
if (st >= 2)
@@ -4878,42 +4920,6 @@
revert_to_self ();
}
- if (errno == ENOTSUP)
- ;
- else if (err == ERROR_SUCCESS)
- {
- retval = 0;
- errno = e;
- }
- else if (err == ERROR_INVALID_OWNER || err == ERROR_NOT_ALL_ASSIGNED
- || err == ERROR_ACCESS_DENIED)
- {
- /* Maybe the requested ACL and the one the file already has are
- identical, in which case we can silently ignore the
- failure. (And no, Windows doesn't.) */
- acl_t current_acl = acl_get_file (fname, ACL_TYPE_ACCESS);
-
- errno = EPERM;
- if (current_acl)
- {
- char *acl_from = acl_to_text (current_acl, NULL);
- char *acl_to = acl_to_text (acl, NULL);
-
- if (acl_from && acl_to && xstrcasecmp (acl_from, acl_to) == 0)
- {
- retval = 0;
- errno = e;
- }
- if (acl_from)
- acl_free (acl_from);
- if (acl_to)
- acl_free (acl_to);
- acl_free (current_acl);
- }
- }
- else if (err == ERROR_FILE_NOT_FOUND || err == ERROR_PATH_NOT_FOUND)
- errno = ENOENT;
-
return retval;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] /srv/bzr/emacs/trunk r111578: Another minor fix in acl_set_file on Windows.,
Eli Zaretskii <=