aboutsummaryrefslogtreecommitdiffstats
path: root/src/fileio.c
diff options
context:
space:
mode:
authorJoakim Verona2012-12-30 00:03:52 +0100
committerJoakim Verona2012-12-30 00:03:52 +0100
commitea2da3d8fbf19765a9bd82292bfc73918f74048d (patch)
treeb350dbdaa6601f4384a3fbde01eeaea297d4f047 /src/fileio.c
parent16b9f224223b3e9eb0c4b313e4257dacbd3ebe34 (diff)
parenteff2eb5812e964024c3aa20197b21f12d37155dd (diff)
downloademacs-ea2da3d8fbf19765a9bd82292bfc73918f74048d.tar.gz
emacs-ea2da3d8fbf19765a9bd82292bfc73918f74048d.zip
auto upstream
Diffstat (limited to 'src/fileio.c')
-rw-r--r--src/fileio.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/src/fileio.c b/src/fileio.c
index 9f70c790592..0e63e3f18d9 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -2029,7 +2029,15 @@ entries (depending on how Emacs was built). */)
2029 if (!CopyFile (SDATA (encoded_file), 2029 if (!CopyFile (SDATA (encoded_file),
2030 SDATA (encoded_newname), 2030 SDATA (encoded_newname),
2031 FALSE)) 2031 FALSE))
2032 report_file_error ("Copying file", Fcons (file, Fcons (newname, Qnil))); 2032 {
2033 /* CopyFile doesn't set errno when it fails. By far the most
2034 "popular" reason is that the target is read-only. */
2035 if (GetLastError () == 5)
2036 errno = EACCES;
2037 else
2038 errno = EPERM;
2039 report_file_error ("Copying file", Fcons (file, Fcons (newname, Qnil)));
2040 }
2033 /* CopyFile retains the timestamp by default. */ 2041 /* CopyFile retains the timestamp by default. */
2034 else if (NILP (keep_time)) 2042 else if (NILP (keep_time))
2035 { 2043 {
@@ -2996,8 +3004,10 @@ DEFUN ("set-file-selinux-context", Fset_file_selinux_context,
2996CONTEXT should be a list (USER ROLE TYPE RANGE), where the list 3004CONTEXT should be a list (USER ROLE TYPE RANGE), where the list
2997elements are strings naming the components of a SELinux context. 3005elements are strings naming the components of a SELinux context.
2998 3006
2999This function does nothing if SELinux is disabled, or if Emacs was not 3007Value is t if setting of SELinux context was successful, nil otherwise.
3000compiled with SELinux support. */) 3008
3009This function does nothing and returns nil if SELinux is disabled,
3010or if Emacs was not compiled with SELinux support. */)
3001 (Lisp_Object filename, Lisp_Object context) 3011 (Lisp_Object filename, Lisp_Object context)
3002{ 3012{
3003 Lisp_Object absname; 3013 Lisp_Object absname;
@@ -3063,6 +3073,7 @@ compiled with SELinux support. */)
3063 3073
3064 context_free (parsed_con); 3074 context_free (parsed_con);
3065 freecon (con); 3075 freecon (con);
3076 return fail ? Qnil : Qt;
3066 } 3077 }
3067 else 3078 else
3068 report_file_error ("Doing lgetfilecon", Fcons (absname, Qnil)); 3079 report_file_error ("Doing lgetfilecon", Fcons (absname, Qnil));
@@ -3127,6 +3138,8 @@ DEFUN ("set-file-acl", Fset_file_acl, Sset_file_acl,
3127ACL-STRING should contain the textual representation of the ACL 3138ACL-STRING should contain the textual representation of the ACL
3128entries in a format suitable for the platform. 3139entries in a format suitable for the platform.
3129 3140
3141Value is t if setting of ACL was successful, nil otherwise.
3142
3130Setting ACL for local files requires Emacs to be built with ACL 3143Setting ACL for local files requires Emacs to be built with ACL
3131support. */) 3144support. */)
3132 (Lisp_Object filename, Lisp_Object acl_string) 3145 (Lisp_Object filename, Lisp_Object acl_string)
@@ -3166,6 +3179,7 @@ support. */)
3166 report_file_error ("Setting ACL", Fcons (absname, Qnil)); 3179 report_file_error ("Setting ACL", Fcons (absname, Qnil));
3167 3180
3168 acl_free (acl); 3181 acl_free (acl);
3182 return fail ? Qnil : Qt;
3169 } 3183 }
3170#endif 3184#endif
3171 3185