[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master f157576: Fix return value of 'set-file-extended-att
From: |
Eli Zaretskii |
Subject: |
[Emacs-diffs] master f157576: Fix return value of 'set-file-extended-attributes' |
Date: |
Mon, 19 Oct 2015 07:05:50 +0000 |
branch: master
commit f1575763c0d30df9f9e5b730c2f2c68f501cda9c
Author: Eli Zaretskii <address@hidden>
Commit: Eli Zaretskii <address@hidden>
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.
---
doc/lispref/files.texi | 2 ++
lisp/files.el | 21 +++++++++++++--------
2 files changed, 15 insertions(+), 8 deletions(-)
diff --git a/doc/lispref/files.texi b/doc/lispref/files.texi
index 4d2761e..ca8abe5 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}
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
diff --git a/lisp/files.el b/lisp/files.el
index 8565aa8..d0e3e68 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -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))
(defun backup-buffer ()
"Make a backup of the disk file visited by the current buffer, if
appropriate.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] master f157576: Fix return value of 'set-file-extended-attributes',
Eli Zaretskii <=