Function: set-file-acl
set-file-acl is a function defined in fileio.c.
Signature
(set-file-acl FILENAME ACL-STRING)
Documentation
Set ACL of file named FILENAME to ACL-STRING.
ACL-STRING should contain the textual representation of the ACL entries in a format suitable for the platform.
Value is t if setting of ACL was successful, nil otherwise.
Setting ACL for local files requires Emacs to be built with ACL support.
Other relevant functions are documented in the file group.
Probably introduced at or before Emacs version 24.4.
Shortdoc
;; file
(set-file-acl "/tmp/foo" "group::rxx")
e.g. => t
Source Code
// Defined in /usr/src/emacs/src/fileio.c
{
#if USE_ACL
Lisp_Object absname;
Lisp_Object handler;
# ifdef HAVE_ACL_SET_FILE
Lisp_Object encoded_absname;
acl_t acl;
bool fail;
# endif
absname = Fexpand_file_name (filename, BVAR (current_buffer, directory));
/* If the file name has special constructs in it,
call the corresponding file name handler. */
handler = Ffind_file_name_handler (absname, Qset_file_acl);
if (!NILP (handler))
return calln (handler, Qset_file_acl, absname, acl_string);
# ifdef HAVE_ACL_SET_FILE
if (STRINGP (acl_string))
{
acl = acl_from_text (SSDATA (acl_string));
if (acl == NULL)
{
if (acl_errno_valid (errno))
report_file_error ("Converting ACL", absname);
return Qnil;
}
encoded_absname = ENCODE_FILE (absname);
fail = (acl_set_file (SSDATA (encoded_absname), ACL_TYPE_ACCESS,
acl)
!= 0);
acl_free (acl);
if (fail && acl_errno_valid (errno))
report_file_error ("Setting ACL", absname);
return fail ? Qnil : Qt;
}
# endif
#endif
return Qnil;
}