aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog10
-rw-r--r--src/data.c2
-rw-r--r--src/fileio.c20
-rw-r--r--src/w32proc.c12
4 files changed, 40 insertions, 4 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 79d1982cc0e..e95df2b8953 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,13 @@
12012-12-29 Eli Zaretskii <eliz@gnu.org>
2
3 * fileio.c (Fset_file_selinux_context, Fset_file_acl): Return t if
4 file's SELinux context or ACLs successfully set, nil otherwise.
5 (Bug#13298)
6 (Fcopy_file) [WINDOWSNT]: Improve diagnostics when CopyFile fails.
7
8 * w32proc.c (reader_thread): Avoid passing NULL handles to
9 SetEvent and WaitForSingleObject.
10
12012-12-28 Paul Eggert <eggert@cs.ucla.edu> 112012-12-28 Paul Eggert <eggert@cs.ucla.edu>
2 12
3 Port EXTERNALLY_VISIBLE to Clang 3.2. 13 Port EXTERNALLY_VISIBLE to Clang 3.2.
diff --git a/src/data.c b/src/data.c
index a72fa3e2b5f..c0f35ac0916 100644
--- a/src/data.c
+++ b/src/data.c
@@ -583,7 +583,7 @@ DEFUN ("symbol-function", Fsymbol_function, Ssymbol_function, 1, 1, 0,
583 (register Lisp_Object symbol) 583 (register Lisp_Object symbol)
584{ 584{
585 CHECK_SYMBOL (symbol); 585 CHECK_SYMBOL (symbol);
586 return XSYMBOL (symbol)->function; 586 return XSYMBOL (symbol)->function;
587} 587}
588 588
589DEFUN ("symbol-plist", Fsymbol_plist, Ssymbol_plist, 1, 1, 0, 589DEFUN ("symbol-plist", Fsymbol_plist, Ssymbol_plist, 1, 1, 0,
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
diff --git a/src/w32proc.c b/src/w32proc.c
index 5c43a57db29..8977ca38a15 100644
--- a/src/w32proc.c
+++ b/src/w32proc.c
@@ -970,6 +970,11 @@ reader_thread (void *arg)
970 else 970 else
971 rc = _sys_read_ahead (cp->fd); 971 rc = _sys_read_ahead (cp->fd);
972 972
973 /* Don't bother waiting for the event if we already have been
974 told to exit by delete_child. */
975 if (cp->status == STATUS_READ_ERROR || !cp->char_avail)
976 break;
977
973 /* The name char_avail is a misnomer - it really just means the 978 /* The name char_avail is a misnomer - it really just means the
974 read-ahead has completed, whether successfully or not. */ 979 read-ahead has completed, whether successfully or not. */
975 if (!SetEvent (cp->char_avail)) 980 if (!SetEvent (cp->char_avail))
@@ -986,6 +991,11 @@ reader_thread (void *arg)
986 if (rc == STATUS_READ_FAILED) 991 if (rc == STATUS_READ_FAILED)
987 break; 992 break;
988 993
994 /* Don't bother waiting for the acknowledge if we already have
995 been told to exit by delete_child. */
996 if (cp->status == STATUS_READ_ERROR || !cp->char_consumed)
997 break;
998
989 /* Wait until our input is acknowledged before reading again */ 999 /* Wait until our input is acknowledged before reading again */
990 if (WaitForSingleObject (cp->char_consumed, INFINITE) != WAIT_OBJECT_0) 1000 if (WaitForSingleObject (cp->char_consumed, INFINITE) != WAIT_OBJECT_0)
991 { 1001 {
@@ -993,6 +1003,8 @@ reader_thread (void *arg)
993 "%lu for fd %ld\n", GetLastError (), cp->fd)); 1003 "%lu for fd %ld\n", GetLastError (), cp->fd));
994 break; 1004 break;
995 } 1005 }
1006 /* delete_child sets status to STATUS_READ_ERROR when it wants
1007 us to exit. */
996 if (cp->status == STATUS_READ_ERROR) 1008 if (cp->status == STATUS_READ_ERROR)
997 break; 1009 break;
998 } 1010 }