summaryrefslogtreecommitdiff
path: root/src/fileio.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/fileio.c')
-rw-r--r--src/fileio.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/src/fileio.c b/src/fileio.c
index 5d33fb93878..85431dfd5b1 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -1951,9 +1951,10 @@ on the system, we copy the SELinux context of FILE to NEWNAME. */)
owner and group. */
if (input_file_statable_p)
{
- if (! NILP (preserve_uid_gid))
- fchown (ofd, st.st_uid, st.st_gid);
- fchmod (ofd, st.st_mode & 07777);
+ if (!NILP (preserve_uid_gid) && fchown (ofd, st.st_uid, st.st_gid) != 0)
+ report_file_error ("Doing chown", Fcons (newname, Qnil));
+ if (fchmod (ofd, st.st_mode & 07777) != 0)
+ report_file_error ("Doing chmod", Fcons (newname, Qnil));
}
#endif /* not MSDOS */
@@ -2358,8 +2359,6 @@ static int
check_executable (char *filename)
{
#ifdef DOS_NT
- int len = strlen (filename);
- char *suffix;
struct stat st;
if (stat (filename, &st) < 0)
return 0;
@@ -2785,13 +2784,14 @@ as a list ("user", "role", "type", "range"). Has no effect if SELinux
is disabled. */)
(Lisp_Object filename, Lisp_Object context)
{
- Lisp_Object absname, encoded_absname;
+ Lisp_Object absname;
Lisp_Object handler;
+#if HAVE_LIBSELINUX
+ Lisp_Object encoded_absname;
Lisp_Object user = CAR_SAFE (context);
Lisp_Object role = CAR_SAFE (CDR_SAFE (context));
Lisp_Object type = CAR_SAFE (CDR_SAFE (CDR_SAFE (context)));
Lisp_Object range = CAR_SAFE (CDR_SAFE (CDR_SAFE (CDR_SAFE (context))));
-#if HAVE_LIBSELINUX
security_context_t con;
int fail, conlength;
context_t parsed_con;
@@ -2805,12 +2805,11 @@ is disabled. */)
if (!NILP (handler))
return call3 (handler, Qset_file_selinux_context, absname, context);
- encoded_absname = ENCODE_FILE (absname);
-
#if HAVE_LIBSELINUX
if (is_selinux_enabled ())
{
/* Get current file context. */
+ encoded_absname = ENCODE_FILE (absname);
conlength = lgetfilecon (SSDATA (encoded_absname), &con);
if (conlength > 0)
{
@@ -5179,7 +5178,7 @@ A non-nil CURRENT-ONLY argument means save only current buffer. */)
(Lisp_Object no_message, Lisp_Object current_only)
{
struct buffer *old = current_buffer, *b;
- Lisp_Object tail, buf;
+ Lisp_Object tail, buf, hook;
int auto_saved = 0;
int do_handled_files;
Lisp_Object oquit;
@@ -5209,8 +5208,8 @@ A non-nil CURRENT-ONLY argument means save only current buffer. */)
/* No GCPRO needed, because (when it matters) all Lisp_Object variables
point to non-strings reached from Vbuffer_alist. */
- if (!NILP (Vrun_hooks))
- call1 (Vrun_hooks, intern ("auto-save-hook"));
+ hook = intern ("auto-save-hook");
+ Frun_hooks (1, &hook);
if (STRINGP (Vauto_save_list_file_name))
{