Function: tramp-sudoedit-handle-set-file-selinux-context
tramp-sudoedit-handle-set-file-selinux-context is a byte-compiled
function defined in tramp-sudoedit.el.gz.
Signature
(tramp-sudoedit-handle-set-file-selinux-context FILENAME CONTEXT)
Documentation
Like set-file-selinux-context for Tramp files.
Source Code
;; Defined in /usr/src/emacs/lisp/net/tramp-sudoedit.el.gz
(defun tramp-sudoedit-handle-set-file-selinux-context (filename context)
"Like `set-file-selinux-context' for Tramp files."
(with-parsed-tramp-file-name (expand-file-name filename) nil
(when (and (consp context)
(tramp-sudoedit-remote-selinux-p v))
(let ((user (and (stringp (nth 0 context)) (nth 0 context)))
(role (and (stringp (nth 1 context)) (nth 1 context)))
(type (and (stringp (nth 2 context)) (nth 2 context)))
(range (and (stringp (nth 3 context)) (nth 3 context))))
(when (tramp-sudoedit-send-command
v "chcon"
(when user (format "--user=%s" user))
(when role (format "--role=%s" role))
(when type (format "--type=%s" type))
(when range (format "--range=%s" range))
(tramp-compat-file-name-unquote localname))
(if (and user role type range)
(tramp-set-file-property
v localname "file-selinux-context" context)
(tramp-flush-file-property v localname "file-selinux-context"))
t)))))