diff options
| author | Eli Zaretskii | 2012-12-29 16:32:36 +0200 |
|---|---|---|
| committer | Eli Zaretskii | 2012-12-29 16:32:36 +0200 |
| commit | ccad023bc3c70fc8368c00f7ed2f5ec947a4260d (patch) | |
| tree | c6471cecd468c61a1a81860215f731e265721a88 /src | |
| parent | ccb1c17e8bf1aa0d21bddd9fa37154a120657f52 (diff) | |
| download | emacs-ccad023bc3c70fc8368c00f7ed2f5ec947a4260d.tar.gz emacs-ccad023bc3c70fc8368c00f7ed2f5ec947a4260d.zip | |
Fix bug #13298 with failed backups by falling back on set-file-modes.
src/fileio.c (Fset_file_selinux_context, Fset_file_acl): Return t if
file's SELinux context or ACLs successfully set, nil otherwise.
lisp/files.el (backup-buffer-copy, basic-save-buffer-2): If
set-file-extended-attributes fails, fall back on set-file-modes
instead of signaling an error.
doc/lispref/files.texi (Changing Files): Document the return values of
set-file-selinux-context and set-file-acl.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 4 | ||||
| -rw-r--r-- | src/fileio.c | 10 |
2 files changed, 12 insertions, 2 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 76f6865972c..f40f936d13a 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,5 +1,9 @@ | |||
| 1 | 2012-12-29 Eli Zaretskii <eliz@gnu.org> | 1 | 2012-12-29 Eli Zaretskii <eliz@gnu.org> |
| 2 | 2 | ||
| 3 | * fileio.c (Fset_file_selinux_context, Fset_file_acl): Return t if | ||
| 4 | file's SELinux context or ACLs successfully set, nil otherwise. | ||
| 5 | (Bug#13298) | ||
| 6 | |||
| 3 | * w32proc.c (reader_thread): Avoid passing NULL handles to | 7 | * w32proc.c (reader_thread): Avoid passing NULL handles to |
| 4 | SetEvent and WaitForSingleObject. | 8 | SetEvent and WaitForSingleObject. |
| 5 | 9 | ||
diff --git a/src/fileio.c b/src/fileio.c index 9f70c790592..e824a7abcc5 100644 --- a/src/fileio.c +++ b/src/fileio.c | |||
| @@ -2996,8 +2996,10 @@ DEFUN ("set-file-selinux-context", Fset_file_selinux_context, | |||
| 2996 | CONTEXT should be a list (USER ROLE TYPE RANGE), where the list | 2996 | CONTEXT should be a list (USER ROLE TYPE RANGE), where the list |
| 2997 | elements are strings naming the components of a SELinux context. | 2997 | elements are strings naming the components of a SELinux context. |
| 2998 | 2998 | ||
| 2999 | This function does nothing if SELinux is disabled, or if Emacs was not | 2999 | Value is t if setting of SELinux context was successful, nil otherwise. |
| 3000 | compiled with SELinux support. */) | 3000 | |
| 3001 | This function does nothing and returns nil if SELinux is disabled, | ||
| 3002 | or if Emacs was not compiled with SELinux support. */) | ||
| 3001 | (Lisp_Object filename, Lisp_Object context) | 3003 | (Lisp_Object filename, Lisp_Object context) |
| 3002 | { | 3004 | { |
| 3003 | Lisp_Object absname; | 3005 | Lisp_Object absname; |
| @@ -3063,6 +3065,7 @@ compiled with SELinux support. */) | |||
| 3063 | 3065 | ||
| 3064 | context_free (parsed_con); | 3066 | context_free (parsed_con); |
| 3065 | freecon (con); | 3067 | freecon (con); |
| 3068 | return Qt; | ||
| 3066 | } | 3069 | } |
| 3067 | else | 3070 | else |
| 3068 | report_file_error ("Doing lgetfilecon", Fcons (absname, Qnil)); | 3071 | report_file_error ("Doing lgetfilecon", Fcons (absname, Qnil)); |
| @@ -3127,6 +3130,8 @@ DEFUN ("set-file-acl", Fset_file_acl, Sset_file_acl, | |||
| 3127 | ACL-STRING should contain the textual representation of the ACL | 3130 | ACL-STRING should contain the textual representation of the ACL |
| 3128 | entries in a format suitable for the platform. | 3131 | entries in a format suitable for the platform. |
| 3129 | 3132 | ||
| 3133 | Value is t if setting of ACL was successful, nil otherwise. | ||
| 3134 | |||
| 3130 | Setting ACL for local files requires Emacs to be built with ACL | 3135 | Setting ACL for local files requires Emacs to be built with ACL |
| 3131 | support. */) | 3136 | support. */) |
| 3132 | (Lisp_Object filename, Lisp_Object acl_string) | 3137 | (Lisp_Object filename, Lisp_Object acl_string) |
| @@ -3166,6 +3171,7 @@ support. */) | |||
| 3166 | report_file_error ("Setting ACL", Fcons (absname, Qnil)); | 3171 | report_file_error ("Setting ACL", Fcons (absname, Qnil)); |
| 3167 | 3172 | ||
| 3168 | acl_free (acl); | 3173 | acl_free (acl); |
| 3174 | return Qt; | ||
| 3169 | } | 3175 | } |
| 3170 | #endif | 3176 | #endif |
| 3171 | 3177 | ||