diff options
| author | Richard M. Stallman | 1994-05-14 06:34:26 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1994-05-14 06:34:26 +0000 |
| commit | 5acac34e2a01eb811c6e532fa580d8208064a7d3 (patch) | |
| tree | 73033f05a507ac74d27733adc4c246de5c58752b /src | |
| parent | bbe20e81d118a448ac52e2daff279c1e159d6428 (diff) | |
| download | emacs-5acac34e2a01eb811c6e532fa580d8208064a7d3.tar.gz emacs-5acac34e2a01eb811c6e532fa580d8208064a7d3.zip | |
(Fcopy_file): Close output before setting its times.
Close both before discarding the unwind protects.
Diffstat (limited to 'src')
| -rw-r--r-- | src/fileio.c | 10 |
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 | } |