changeset 7493:f4fb8b913c5d

(Fcopy_file): Close output before setting its times. Close both before discarding the unwind protects.
author Richard M. Stallman <rms@gnu.org>
date Sat, 14 May 1994 06:34:26 +0000
parents 4ba64e05dad6
children de1c896460da
files src/fileio.c
diffstat 1 files changed, 6 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/fileio.c	Fri May 13 22:21:45 1994 +0000
+++ b/src/fileio.c	Sat May 14 06:34:26 1994 +0000
@@ -1803,6 +1803,10 @@
 	report_file_error ("I/O error", Fcons (newname, Qnil));
   immediate_quit = 0;
 
+  /* Closing the output clobbers the file times on some systems.  */
+  if (close (ofd) < 0)
+    report_file_error ("I/O error", Fcons (newname, Qnil));
+
   if (input_file_statable_p)
     {
       if (!NILP (keep_date))
@@ -1818,13 +1822,11 @@
 	chmod (XSTRING (newname)->data, st.st_mode & 07777);
     }
 
+  close (ifd);
+
   /* Discard the unwind protects.  */
   specpdl_ptr = specpdl + count;
 
-  close (ifd);
-  if (close (ofd) < 0)
-    report_file_error ("I/O error", Fcons (newname, Qnil));
-
   UNGCPRO;
   return Qnil;
 }