aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/fileio.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/fileio.c b/src/fileio.c
index 0df30ef2c43..4f1ff5bf69e 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -1803,6 +1803,10 @@ A prefix arg makes KEEP-TIME non-nil.")
1803 report_file_error ("I/O error", Fcons (newname, Qnil)); 1803 report_file_error ("I/O error", Fcons (newname, Qnil));
1804 immediate_quit = 0; 1804 immediate_quit = 0;
1805 1805
1806 /* Closing the output clobbers the file times on some systems. */
1807 if (close (ofd) < 0)
1808 report_file_error ("I/O error", Fcons (newname, Qnil));
1809
1806 if (input_file_statable_p) 1810 if (input_file_statable_p)
1807 { 1811 {
1808 if (!NILP (keep_date)) 1812 if (!NILP (keep_date))
@@ -1818,13 +1822,11 @@ A prefix arg makes KEEP-TIME non-nil.")
1818 chmod (XSTRING (newname)->data, st.st_mode & 07777); 1822 chmod (XSTRING (newname)->data, st.st_mode & 07777);
1819 } 1823 }
1820 1824
1825 close (ifd);
1826
1821 /* Discard the unwind protects. */ 1827 /* Discard the unwind protects. */
1822 specpdl_ptr = specpdl + count; 1828 specpdl_ptr = specpdl + count;
1823 1829
1824 close (ifd);
1825 if (close (ofd) < 0)
1826 report_file_error ("I/O error", Fcons (newname, Qnil));
1827
1828 UNGCPRO; 1830 UNGCPRO;
1829 return Qnil; 1831 return Qnil;
1830} 1832}