]> code.delx.au - gnu-emacs/commitdiff
Fix return value of 'set-file-extended-attributes'
authorEli Zaretskii <eliz@gnu.org>
Mon, 19 Oct 2015 07:04:50 +0000 (10:04 +0300)
committerEli Zaretskii <eliz@gnu.org>
Mon, 19 Oct 2015 07:04:50 +0000 (10:04 +0300)
* 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.

doc/lispref/files.texi
lisp/files.el

index 4d2761ed4197ee1445b26afbf339799066c0cec5..ca8abe54ace137d9ea71e0ffa5491c8eb8748005 100644 (file)
@@ -1758,6 +1758,8 @@ time and must be in the format returned by @code{current-time}
 This function sets the Emacs-recognized extended file attributes for
 @code{filename}.  The second argument @var{attribute-alist} should be
 an alist of the same form returned by @code{file-extended-attributes}.
+The return value is @code{t} if the attributes are successfully set,
+otherwise it is @code{nil}.
 @xref{Extended Attributes}.
 @end defun
 
index 8565aa83266b900cca158f02ed23c70bd7bb17bf..d0e3e6886f022db42b03dc083f3b2152e9ed5de1 100644 (file)
@@ -4055,14 +4055,19 @@ such as SELinux context, list of ACL entries, etc."
   "Set extended attributes of file FILENAME to ATTRIBUTES.
 
 ATTRIBUTES must be an alist of file attributes as returned by
-`file-extended-attributes'."
-  (dolist (elt attributes)
-    (let ((attr (car elt))
-         (val (cdr elt)))
-      (cond ((eq attr 'acl)
-            (set-file-acl filename val))
-           ((eq attr 'selinux-context)
-            (set-file-selinux-context filename val))))))
+`file-extended-attributes'.
+Value is t if the function succeeds in setting the attributes."
+  (let (result rv)
+    (dolist (elt attributes)
+      (let ((attr (car elt))
+           (val (cdr elt)))
+       (cond ((eq attr 'acl)
+               (setq rv (set-file-acl filename val)))
+             ((eq attr 'selinux-context)
+               (setq rv (set-file-selinux-context filename val))))
+        (setq result (or result rv))))
+
+    result))
 \f
 (defun backup-buffer ()
   "Make a backup of the disk file visited by the current buffer, if appropriate.