diff --git a/0002-use-futimens-if-available-instead-of-utime.patch b/0002-use-futimens-if-available-instead-of-utime.patch index 26a7174..7c0fe84 100644 --- a/0002-use-futimens-if-available-instead-of-utime.patch +++ b/0002-use-futimens-if-available-instead-of-utime.patch @@ -7,8 +7,8 @@ Subject: [PATCH 3/3] use futimens() if available, instead of utime() config.h.in | 3 +++ configure | 2 +- configure.ac | 2 +- - src/files.c | 26 +++++++++++++++++++++++++- - 4 files changed, 30 insertions(+), 3 deletions(-) + src/files.c | 48 ++++++++++++++++++++++++++++++++++++------------ + 4 files changed, 41 insertions(+), 14 deletions(-) diff --git a/config.h.in b/config.h.in index 52e13f1..cb17b29 100644 @@ -84,16 +84,45 @@ index 99cc1b8..9a1bdcc 100644 /* Write a file out to disk. If f_open isn't NULL, we assume that it is * a stream associated with the file, and we don't try to open it * ourselves. If tmp is TRUE, we set the umask to disallow anyone else -@@ -1928,7 +1951,8 @@ bool write_file(const char *name, FILE *f_open, bool tmp, append_type - } +@@ -1917,18 +1940,9 @@ bool write_file(const char *name, FILE *f_open, bool tmp, append_type + fprintf(stderr, "Backing up %s to %s\n", realname, backupname); + #endif - /* And set its metadata. */ +- /* Copy the file. */ +- copy_status = copy_file(f, backup_file); +- +- if (copy_status != 0) { +- statusbar(_("Error reading %s: %s"), realname, +- strerror(errno)); +- beep(); +- goto cleanup_and_exit; +- } +- +- /* And set its metadata. */ - if (utime(backupname, &filetime) == -1 && !ISSET(INSECURE_BACKUP)) { ++ /* Set backup's file metadata. */ + if (utime_wrap(backup_fd, backupname, &filetime) == -1 + && !ISSET(INSECURE_BACKUP)) { if (prompt_failed_backupwrite(backupname)) goto skip_backup; statusbar(_("Error writing backup file %s: %s"), backupname, +@@ -1940,6 +1954,16 @@ bool write_file(const char *name, FILE *f_open, bool tmp, append_type + goto cleanup_and_exit; + } + ++ /* Copy the file. */ ++ copy_status = copy_file(f, backup_file); ++ ++ if (copy_status != 0) { ++ statusbar(_("Error reading %s: %s"), realname, ++ strerror(errno)); ++ beep(); ++ goto cleanup_and_exit; ++ } ++ + free(backupname); + } + -- 1.7.4 diff --git a/nano.spec b/nano.spec index 9836084..ef013b1 100644 --- a/nano.spec +++ b/nano.spec @@ -1,7 +1,7 @@ Summary: A small text editor Name: nano Version: 2.3.6 -Release: 2%{?dist} +Release: 3%{?dist} License: GPLv3+ Group: Applications/Editors URL: http://www.nano-editor.org @@ -90,6 +90,9 @@ exit 0 %{_datadir}/nano %changelog +* Mon Jan 05 2015 Kamil Dudka - 2.3.6-3 +- do not use closed file descriptor when setting backup's timestamp (#1177155) + * Sun Aug 17 2014 Fedora Release Engineering - 2.3.6-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild