new upstream release - 2.5.2

This commit is contained in:
Kamil Dudka 2016-02-12 08:39:18 +01:00
parent bb494dd06e
commit da35cc24bd
6 changed files with 15 additions and 96 deletions

View File

@ -1,80 +0,0 @@
From fc87b0a32c130a2b3ab37e614d4a1c6c8e5d70e7 Mon Sep 17 00:00:00 2001
From: Kamil Dudka <kdudka@redhat.com>
Date: Thu, 19 Aug 2010 13:58:12 +0200
Subject: [PATCH 2/3] check stat's result and avoid calling stat on a NULL pointer
---
src/files.c | 36 +++++++++++++++++++++++++-----------
1 file changed, 25 insertions(+), 11 deletions(-)
diff --git a/src/files.c b/src/files.c
index f6efbf1..99cc1b8 100644
--- a/src/files.c
+++ b/src/files.c
@@ -321,6 +321,24 @@ int do_lockfile(const char *filename)
}
#endif /* !NANO_TINY */
+#ifndef NANO_TINY
+/* If *pstat is NULL, perform a stat call with the given file name. On success,
+ * *pstat points to a newly allocated buffer that contains the stat's result.
+ * On stat's failure, the NULL pointer in *pstat is left intact. */
+void stat_if_needed(const char *filename, struct stat **pstat)
+{
+ struct stat *tmp;
+ if (*pstat)
+ return;
+
+ tmp = (struct stat *)nmalloc(sizeof(struct stat));
+ if (0 == stat(filename, tmp))
+ *pstat = tmp;
+ else
+ free(tmp);
+}
+#endif
+
/* If it's not "", filename is a file to open. We make a new buffer, if
* necessary, and then open and read the file, if applicable. */
bool open_buffer(const char *filename, bool undoable)
@@ -399,11 +417,7 @@ bool open_buffer(const char *filename, bool undoable)
if (rc > 0) {
read_file(f, rc, filename, undoable, new_buffer);
#ifndef NANO_TINY
- if (openfile->current_stat == NULL) {
- openfile->current_stat =
- (struct stat *)nmalloc(sizeof(struct stat));
- stat(filename, openfile->current_stat);
- }
+ stat_if_needed(filename, &openfile->current_stat);
#endif
}
@@ -1744,10 +1758,8 @@ bool write_file(const char *name, FILE *f_open, bool tmp, append_type
* specified it interactively), stat and save the value now,
* or else we will chase null pointers when we do modtime checks,
* preserve file times, and so on, during backup. */
- if (openfile->current_stat == NULL && !tmp && realexists) {
- openfile->current_stat = (struct stat *)nmalloc(sizeof(struct stat));
- stat(realname, openfile->current_stat);
- }
+ if (!tmp && realexists)
+ stat_if_needed(realname, &openfile->current_stat);
/* We backup only if the backup toggle is set, the file isn't
* temporary, and the file already exists. Furthermore, if we
@@ -2137,8 +2149,10 @@ bool write_file(const char *name, FILE *f_open, bool tmp, append_type
if (openfile->current_stat == NULL)
openfile->current_stat =
(struct stat *)nmalloc(sizeof(struct stat));
- if (!openfile->mark_set)
- stat(realname, openfile->current_stat);
+ if (!openfile->mark_set && 0 != stat(realname, openfile->current_stat)) {
+ free(openfile->current_stat);
+ openfile->current_stat = NULL;
+ }
#endif
statusbar(P_("Wrote %lu line", "Wrote %lu lines",
--
1.7.4

View File

@ -54,7 +54,7 @@ diff --git a/src/files.c b/src/files.c
index 99cc1b8..9a1bdcc 100644
--- a/src/files.c
+++ b/src/files.c
@@ -1667,6 +1667,29 @@ int copy_file(FILE *inn, FILE *out)
@@ -1739,6 +1739,29 @@ int copy_file(FILE *inn, FILE *out)
return retval;
}
@ -84,7 +84,7 @@ 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
@@ -1908,18 +1931,9 @@ bool write_file(const char *name, FILE *f_open, bool tmp, append_type
@@ -1962,18 +1985,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
@ -106,7 +106,7 @@ index 99cc1b8..9a1bdcc 100644
if (prompt_failed_backupwrite(backupname))
goto skip_backup;
statusbar(_("Error writing backup file %s: %s"), backupname,
@@ -1931,6 +1945,16 @@ bool write_file(const char *name, FILE *f_open, bool tmp, append_type
@@ -1985,6 +1999,16 @@ bool write_file(const char *name, FILE *f_open, bool tmp, append_type
goto cleanup_and_exit;
}

View File

@ -1,7 +0,0 @@
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
iEYEABECAAYFAlaTOJAACgkQvLNW35EAn6cUYwCg06jx/7wtlHA9Fx2VI/wfiL29
25wAn3ew1mra5GWeQ4zck4/VicUC2qE1
=sSKY
-----END PGP SIGNATURE-----

7
nano-2.5.2.tar.gz.asc Normal file
View File

@ -0,0 +1,7 @@
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
iEYEABECAAYFAla9bhYACgkQvLNW35EAn6ff9gCg3DKEWUL4ziF8XCkrqeYvhVkk
MbQAoJZDgn87akhFXREZCQLrKaRfjds8
=c8Uf
-----END PGP SIGNATURE-----

View File

@ -1,6 +1,6 @@
Summary: A small text editor
Name: nano
Version: 2.5.1
Version: 2.5.2
Release: 2%{?dist}
License: GPLv3+
Group: Applications/Editors
@ -9,9 +9,6 @@ Source: http://www.nano-editor.org/dist/v2.5/%{name}-%{version}.tar.gz
Source2: nanorc
Patch0: nano-2.3.3-warnings.patch
# http://lists.gnu.org/archive/html/nano-devel/2010-08/msg00004.html
Patch1: 0001-check-stat-s-result-and-avoid-calling-stat-on-a-NULL.patch
# http://lists.gnu.org/archive/html/nano-devel/2010-08/msg00005.html
Patch2: 0002-use-futimens-if-available-instead-of-utime.patch
@ -32,7 +29,6 @@ GNU nano is a small and friendly text editor.
%prep
%setup -q
%patch0 -p1
%patch1 -p1
%patch2 -p1
for f in doc/man/fr/{nano.1,nanorc.5,rnano.1} ; do
@ -96,6 +92,9 @@ exit 0
%{_datadir}/nano
%changelog
* Fri Feb 12 2016 Kamil Dudka <kdudka@redhat.com> - 2.5.2-1
- new upstream release
* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 2.5.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild

View File

@ -1 +1 @@
f25c7da9813ae5f1df7e5dd1072de4ce nano-2.5.1.tar.gz
036830de22b8a76a0e6f84c0cb36ff12 nano-2.5.2.tar.gz