diff options
Diffstat (limited to 'src/fileio.c')
| -rw-r--r-- | src/fileio.c | 23 |
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. */) | |||
| 1951 | owner and group. */ | 1951 | owner and group. */ |
| 1952 | if (input_file_statable_p) | 1952 | if (input_file_statable_p) |
| 1953 | { | 1953 | { |
| 1954 | if (! NILP (preserve_uid_gid)) | 1954 | if (!NILP (preserve_uid_gid) && fchown (ofd, st.st_uid, st.st_gid) != 0) |
| 1955 | fchown (ofd, st.st_uid, st.st_gid); | 1955 | report_file_error ("Doing chown", Fcons (newname, Qnil)); |
| 1956 | fchmod (ofd, st.st_mode & 07777); | 1956 | if (fchmod (ofd, st.st_mode & 07777) != 0) |
| 1957 | report_file_error ("Doing chmod", Fcons (newname, Qnil)); | ||
| 1957 | } | 1958 | } |
| 1958 | #endif /* not MSDOS */ | 1959 | #endif /* not MSDOS */ |
| 1959 | 1960 | ||
| @@ -2358,8 +2359,6 @@ static int | |||
| 2358 | check_executable (char *filename) | 2359 | check_executable (char *filename) |
| 2359 | { | 2360 | { |
| 2360 | #ifdef DOS_NT | 2361 | #ifdef DOS_NT |
| 2361 | int len = strlen (filename); | ||
| 2362 | char *suffix; | ||
| 2363 | struct stat st; | 2362 | struct stat st; |
| 2364 | if (stat (filename, &st) < 0) | 2363 | if (stat (filename, &st) < 0) |
| 2365 | return 0; | 2364 | return 0; |
| @@ -2785,13 +2784,14 @@ as a list ("user", "role", "type", "range"). Has no effect if SELinux | |||
| 2785 | is disabled. */) | 2784 | is disabled. */) |
| 2786 | (Lisp_Object filename, Lisp_Object context) | 2785 | (Lisp_Object filename, Lisp_Object context) |
| 2787 | { | 2786 | { |
| 2788 | Lisp_Object absname, encoded_absname; | 2787 | Lisp_Object absname; |
| 2789 | Lisp_Object handler; | 2788 | Lisp_Object handler; |
| 2789 | #if HAVE_LIBSELINUX | ||
| 2790 | Lisp_Object encoded_absname; | ||
| 2790 | Lisp_Object user = CAR_SAFE (context); | 2791 | Lisp_Object user = CAR_SAFE (context); |
| 2791 | Lisp_Object role = CAR_SAFE (CDR_SAFE (context)); | 2792 | Lisp_Object role = CAR_SAFE (CDR_SAFE (context)); |
| 2792 | Lisp_Object type = CAR_SAFE (CDR_SAFE (CDR_SAFE (context))); | 2793 | Lisp_Object type = CAR_SAFE (CDR_SAFE (CDR_SAFE (context))); |
| 2793 | Lisp_Object range = CAR_SAFE (CDR_SAFE (CDR_SAFE (CDR_SAFE (context)))); | 2794 | Lisp_Object range = CAR_SAFE (CDR_SAFE (CDR_SAFE (CDR_SAFE (context)))); |
| 2794 | #if HAVE_LIBSELINUX | ||
| 2795 | security_context_t con; | 2795 | security_context_t con; |
| 2796 | int fail, conlength; | 2796 | int fail, conlength; |
| 2797 | context_t parsed_con; | 2797 | context_t parsed_con; |
| @@ -2805,12 +2805,11 @@ is disabled. */) | |||
| 2805 | if (!NILP (handler)) | 2805 | if (!NILP (handler)) |
| 2806 | return call3 (handler, Qset_file_selinux_context, absname, context); | 2806 | return call3 (handler, Qset_file_selinux_context, absname, context); |
| 2807 | 2807 | ||
| 2808 | encoded_absname = ENCODE_FILE (absname); | ||
| 2809 | |||
| 2810 | #if HAVE_LIBSELINUX | 2808 | #if HAVE_LIBSELINUX |
| 2811 | if (is_selinux_enabled ()) | 2809 | if (is_selinux_enabled ()) |
| 2812 | { | 2810 | { |
| 2813 | /* Get current file context. */ | 2811 | /* Get current file context. */ |
| 2812 | encoded_absname = ENCODE_FILE (absname); | ||
| 2814 | conlength = lgetfilecon (SSDATA (encoded_absname), &con); | 2813 | conlength = lgetfilecon (SSDATA (encoded_absname), &con); |
| 2815 | if (conlength > 0) | 2814 | if (conlength > 0) |
| 2816 | { | 2815 | { |
| @@ -5179,7 +5178,7 @@ A non-nil CURRENT-ONLY argument means save only current buffer. */) | |||
| 5179 | (Lisp_Object no_message, Lisp_Object current_only) | 5178 | (Lisp_Object no_message, Lisp_Object current_only) |
| 5180 | { | 5179 | { |
| 5181 | struct buffer *old = current_buffer, *b; | 5180 | struct buffer *old = current_buffer, *b; |
| 5182 | Lisp_Object tail, buf; | 5181 | Lisp_Object tail, buf, hook; |
| 5183 | int auto_saved = 0; | 5182 | int auto_saved = 0; |
| 5184 | int do_handled_files; | 5183 | int do_handled_files; |
| 5185 | Lisp_Object oquit; | 5184 | Lisp_Object oquit; |
| @@ -5209,8 +5208,8 @@ A non-nil CURRENT-ONLY argument means save only current buffer. */) | |||
| 5209 | /* No GCPRO needed, because (when it matters) all Lisp_Object variables | 5208 | /* No GCPRO needed, because (when it matters) all Lisp_Object variables |
| 5210 | point to non-strings reached from Vbuffer_alist. */ | 5209 | point to non-strings reached from Vbuffer_alist. */ |
| 5211 | 5210 | ||
| 5212 | if (!NILP (Vrun_hooks)) | 5211 | hook = intern ("auto-save-hook"); |
| 5213 | call1 (Vrun_hooks, intern ("auto-save-hook")); | 5212 | Frun_hooks (1, &hook); |
| 5214 | 5213 | ||
| 5215 | if (STRINGP (Vauto_save_list_file_name)) | 5214 | if (STRINGP (Vauto_save_list_file_name)) |
| 5216 | { | 5215 | { |