diff options
| -rw-r--r-- | src/ChangeLog | 6 | ||||
| -rw-r--r-- | src/w32.c | 27 |
2 files changed, 31 insertions, 2 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index c7502104ddf..648f14a61e4 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,5 +1,11 @@ | |||
| 1 | 2012-12-23 Eli Zaretskii <eliz@gnu.org> | 1 | 2012-12-23 Eli Zaretskii <eliz@gnu.org> |
| 2 | 2 | ||
| 3 | * w32.c (acl_set_file): If setting the file security descriptor | ||
| 4 | fails, and the new DACL is identical to the existing one, silently | ||
| 5 | return success. This fixes problems for users backing up their | ||
| 6 | own files without having the necessary privileges for setting | ||
| 7 | security descriptors. | ||
| 8 | |||
| 3 | * w32proc.c (reader_thread): Do not index fd_info[] with negative | 9 | * w32proc.c (reader_thread): Do not index fd_info[] with negative |
| 4 | values. | 10 | values. |
| 5 | (reader_thread): Exit when cp->status becomes STATUS_READ_ERROR | 11 | (reader_thread): Exit when cp->status becomes STATUS_READ_ERROR |
| @@ -4876,8 +4876,31 @@ acl_set_file (const char *fname, acl_type_t type, acl_t acl) | |||
| 4876 | retval = 0; | 4876 | retval = 0; |
| 4877 | errno = e; | 4877 | errno = e; |
| 4878 | } | 4878 | } |
| 4879 | else if (err == ERROR_INVALID_OWNER) | 4879 | else if (err == ERROR_INVALID_OWNER || err == ERROR_NOT_ALL_ASSIGNED) |
| 4880 | errno = EPERM; | 4880 | { |
| 4881 | /* Maybe the requested ACL and the one the file already has are | ||
| 4882 | identical, in which case we can silently ignore the | ||
| 4883 | failure. (And no, Windows doesn't.) */ | ||
| 4884 | acl_t current_acl = acl_get_file (fname, ACL_TYPE_ACCESS); | ||
| 4885 | |||
| 4886 | errno = EPERM; | ||
| 4887 | if (current_acl) | ||
| 4888 | { | ||
| 4889 | char *acl_from = acl_to_text (current_acl, NULL); | ||
| 4890 | char *acl_to = acl_to_text (acl, NULL); | ||
| 4891 | |||
| 4892 | if (acl_from && acl_to && xstrcasecmp (acl_from, acl_to) == 0) | ||
| 4893 | { | ||
| 4894 | retval = 0; | ||
| 4895 | errno = e; | ||
| 4896 | } | ||
| 4897 | if (acl_from) | ||
| 4898 | acl_free (acl_from); | ||
| 4899 | if (acl_to) | ||
| 4900 | acl_free (acl_to); | ||
| 4901 | acl_free (current_acl); | ||
| 4902 | } | ||
| 4903 | } | ||
| 4881 | else if (err == ERROR_FILE_NOT_FOUND || err == ERROR_PATH_NOT_FOUND) | 4904 | else if (err == ERROR_FILE_NOT_FOUND || err == ERROR_PATH_NOT_FOUND) |
| 4882 | errno = ENOENT; | 4905 | errno = ENOENT; |
| 4883 | 4906 | ||