aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEli Zaretskii2015-10-19 10:04:50 +0300
committerEli Zaretskii2015-10-19 10:04:50 +0300
commitf1575763c0d30df9f9e5b730c2f2c68f501cda9c (patch)
treea2c64b716d9255f8bc3724def456834f5820902c
parent552482d41d88fb231ae6cc4857f3050f96710d02 (diff)
downloademacs-f1575763c0d30df9f9e5b730c2f2c68f501cda9c.tar.gz
emacs-f1575763c0d30df9f9e5b730c2f2c68f501cda9c.zip
Fix return value of 'set-file-extended-attributes'
* lisp/files.el (set-file-extended-attributes): Return non-nil when setting either ACLs or SELinux context succeeds. Document the return value. (Bug#21699) * doc/lispref/files.texi (Changing Files): Document the return value of set-file-extended-attributes.
-rw-r--r--doc/lispref/files.texi2
-rw-r--r--lisp/files.el21
2 files changed, 15 insertions, 8 deletions
diff --git a/doc/lispref/files.texi b/doc/lispref/files.texi
index 4d2761ed419..ca8abe54ace 100644
--- a/doc/lispref/files.texi
+++ b/doc/lispref/files.texi
@@ -1758,6 +1758,8 @@ time and must be in the format returned by @code{current-time}
1758This function sets the Emacs-recognized extended file attributes for 1758This function sets the Emacs-recognized extended file attributes for
1759@code{filename}. The second argument @var{attribute-alist} should be 1759@code{filename}. The second argument @var{attribute-alist} should be
1760an alist of the same form returned by @code{file-extended-attributes}. 1760an alist of the same form returned by @code{file-extended-attributes}.
1761The return value is @code{t} if the attributes are successfully set,
1762otherwise it is @code{nil}.
1761@xref{Extended Attributes}. 1763@xref{Extended Attributes}.
1762@end defun 1764@end defun
1763 1765
diff --git a/lisp/files.el b/lisp/files.el
index 8565aa83266..d0e3e6886f0 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -4055,14 +4055,19 @@ such as SELinux context, list of ACL entries, etc."
4055 "Set extended attributes of file FILENAME to ATTRIBUTES. 4055 "Set extended attributes of file FILENAME to ATTRIBUTES.
4056 4056
4057ATTRIBUTES must be an alist of file attributes as returned by 4057ATTRIBUTES must be an alist of file attributes as returned by
4058`file-extended-attributes'." 4058`file-extended-attributes'.
4059 (dolist (elt attributes) 4059Value is t if the function succeeds in setting the attributes."
4060 (let ((attr (car elt)) 4060 (let (result rv)
4061 (val (cdr elt))) 4061 (dolist (elt attributes)
4062 (cond ((eq attr 'acl) 4062 (let ((attr (car elt))
4063 (set-file-acl filename val)) 4063 (val (cdr elt)))
4064 ((eq attr 'selinux-context) 4064 (cond ((eq attr 'acl)
4065 (set-file-selinux-context filename val)))))) 4065 (setq rv (set-file-acl filename val)))
4066 ((eq attr 'selinux-context)
4067 (setq rv (set-file-selinux-context filename val))))
4068 (setq result (or result rv))))
4069
4070 result))
4066 4071
4067(defun backup-buffer () 4072(defun backup-buffer ()
4068 "Make a backup of the disk file visited by the current buffer, if appropriate. 4073 "Make a backup of the disk file visited by the current buffer, if appropriate.