Compare commits
6 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
acd97ad12b | ||
|
|
235537f9b7 | ||
|
|
f4e34be9ae | ||
|
|
64f7a852d5 | ||
|
|
6f88c58042 | ||
|
|
59890c154b |
5 changed files with 31 additions and 148 deletions
|
|
@ -1,126 +0,0 @@
|
|||
From 23510b930ea31f7de8005e2f0ff6cab7062b4e26 Mon Sep 17 00:00:00 2001
|
||||
From: Kamil Dudka <kdudka@redhat.com>
|
||||
Date: Thu, 19 Aug 2010 15:23:06 +0200
|
||||
Subject: [PATCH 2/2] use futimens() if available, instead of utime()
|
||||
|
||||
---
|
||||
config.h.in | 3 +++
|
||||
configure | 2 +-
|
||||
configure.ac | 2 +-
|
||||
src/files.c | 46 +++++++++++++++++++++++++++++++++++-----------
|
||||
4 files changed, 40 insertions(+), 13 deletions(-)
|
||||
|
||||
diff --git a/config.h.in b/config.h.in
|
||||
index 52e13f1..cb17b29 100644
|
||||
--- a/config.h.in
|
||||
+++ b/config.h.in
|
||||
@@ -72,6 +72,9 @@
|
||||
/* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */
|
||||
#undef HAVE_DOPRNT
|
||||
|
||||
+/* Define to 1 if you have the `futimens' function. */
|
||||
+#undef HAVE_FUTIMENS
|
||||
+
|
||||
/* Define to 1 if you have the `getdelim' function. */
|
||||
#undef HAVE_GETDELIM
|
||||
|
||||
diff --git a/configure b/configure
|
||||
index 02733c7..1805e53 100755
|
||||
--- a/configure
|
||||
+++ b/configure
|
||||
@@ -7776,7 +7776,7 @@ fi
|
||||
|
||||
|
||||
|
||||
-for ac_func in getdelim getline isblank strcasecmp strcasestr strncasecmp strnlen snprintf vsnprintf
|
||||
+for ac_func in futimens getdelim getline isblank strcasecmp strcasestr strncasecmp strnlen snprintf vsnprintf
|
||||
do :
|
||||
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
|
||||
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index 66f8ee3..f4975d3 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -442,7 +442,7 @@ int main(void)
|
||||
|
||||
dnl Checks for functions.
|
||||
|
||||
-AC_CHECK_FUNCS(getdelim getline isblank strcasecmp strcasestr strncasecmp strnlen snprintf vsnprintf)
|
||||
+AC_CHECK_FUNCS(futimens getdelim getline isblank strcasecmp strcasestr strncasecmp strnlen snprintf vsnprintf)
|
||||
|
||||
if test "x$enable_utf8" != xno; then
|
||||
AC_CHECK_FUNCS(iswalnum iswblank iswpunct iswspace nl_langinfo mblen mbstowcs mbtowc wctomb wcwidth)
|
||||
diff --git a/src/files.c b/src/files.c
|
||||
index 99cc1b8..9a1bdcc 100644
|
||||
--- a/src/files.c
|
||||
+++ b/src/files.c
|
||||
@@ -1696,6 +1696,29 @@ int copy_file(FILE *inn, FILE *out)
|
||||
return retval;
|
||||
}
|
||||
|
||||
+#ifdef HAVE_FUTIMENS
|
||||
+/* set atime/mtime by file descriptor */
|
||||
+int utime_wrap(int fd, const char *filename, struct utimbuf *ut)
|
||||
+{
|
||||
+ struct timespec times[2];
|
||||
+ (void) filename;
|
||||
+
|
||||
+ times[0].tv_sec = ut->actime;
|
||||
+ times[1].tv_sec = ut->modtime;
|
||||
+ times[0].tv_nsec = 0L;
|
||||
+ times[1].tv_nsec = 0L;
|
||||
+
|
||||
+ return futimens(fd, times);
|
||||
+}
|
||||
+#else
|
||||
+/* set atime/mtime by file name */
|
||||
+int utime_wrap(int fd, const char *filename, struct utimbuf *ut)
|
||||
+{
|
||||
+ (void) fd;
|
||||
+ return utime(filename, ut);
|
||||
+}
|
||||
+#endif
|
||||
+
|
||||
/* 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
|
||||
@@ -1917,17 +1940,9 @@ bool write_file(const char *name, FILE *f_open, bool tmp,
|
||||
fprintf(stderr, "Backing up %s to %s\n", realname, backupname);
|
||||
#endif
|
||||
|
||||
- /* Copy the file. */
|
||||
- copy_status = copy_file(f, backup_file);
|
||||
-
|
||||
- if (copy_status != 0) {
|
||||
- statusline(ALERT, _("Error reading %s: %s"), realname,
|
||||
- strerror(errno));
|
||||
- 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;
|
||||
statusline(HUSH, _("Error writing backup file %s: %s"),
|
||||
@@ -1939,6 +1954,15 @@ bool write_file(const char *name, FILE *f_open, bool tmp,
|
||||
goto cleanup_and_exit;
|
||||
}
|
||||
|
||||
+ /* Copy the file. */
|
||||
+ copy_status = copy_file(f, backup_file);
|
||||
+
|
||||
+ if (copy_status != 0) {
|
||||
+ statusline(ALERT, _("Error reading %s: %s"), realname,
|
||||
+ strerror(errno));
|
||||
+ goto cleanup_and_exit;
|
||||
+ }
|
||||
+
|
||||
free(backupname);
|
||||
}
|
||||
|
||||
--
|
||||
1.7.4
|
||||
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
-----BEGIN PGP SIGNATURE-----
|
||||
|
||||
iQEzBAABCAAdFiEEp/amSmfaCe+SeC3XnfSGKvEXXFsFAliuvfwACgkQnfSGKvEX
|
||||
XFsMkwgAl4JYw3aVvqClkV50hM9S3hTgYXFisnlBcOPax963k7zUjEip5zFmOIcD
|
||||
ctm9CMDXp35kYmwhS5yYkNcgtoRcOwGpWNltrUhJgXU+k1W1aErA4odmuBqdoufS
|
||||
r0b2knVRpPaaSjF+aPNqJRPMZrXdelN0QsVJS5WNkz9WgV6WIRcw0M5U+vjSypov
|
||||
zG/FujMFukiCtCcEuQ+5V+ZNyjHH9BshcCRZCpYVRoKIx6zPTYUSPCZGfiMigoIh
|
||||
gROCll8A+/s6V3E950LFxMtCgQbwZvHTL8eZ6TaYiKgYHNmgzYqys5uPDByD2zY2
|
||||
xo+X27r5HVX+Z8lr3V8fvOCMXjVq+w==
|
||||
=NMSG
|
||||
-----END PGP SIGNATURE-----
|
||||
11
nano-2.8.4.tar.gz.asc
Normal file
11
nano-2.8.4.tar.gz.asc
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
-----BEGIN PGP SIGNATURE-----
|
||||
|
||||
iQEzBAABCAAdFiEEp/amSmfaCe+SeC3XnfSGKvEXXFsFAlkhVs0ACgkQnfSGKvEX
|
||||
XFsgzggAunFKAJXX/ppHkgVdol9Z2XV9jpI8hb5z+kuRzo1N32eNfepxAnWVq4yo
|
||||
jUyjmDRMJ4ALkuSutLC3GVfspSFxxwLvOC1IEUPq3RBqniSrJJ2/RxMBDKuFA0QY
|
||||
3mzzwIi7jQojUTUCOo0m5bJXWwdzdQdgjvxySVnNvXLo/LJBlIO8bKriRNENKCLw
|
||||
/oa5GxBbxnGrD7uTWBMCG5lvz+NYD4tZrDUayyz8+PD56H947/eXo7kHuZOjA4zY
|
||||
X7UMtl8ULL8jzn0OGBNChfo2oUpOIcGqX7Jn0QQMC35Y78ZEYqaeOA4CnZaeoYI9
|
||||
diiuHyW5szDfuQ99AJ30KcEL23Wq5g==
|
||||
=OcXk
|
||||
-----END PGP SIGNATURE-----
|
||||
29
nano.spec
29
nano.spec
|
|
@ -1,15 +1,12 @@
|
|||
Summary: A small text editor
|
||||
Name: nano
|
||||
Version: 2.7.5
|
||||
Version: 2.8.4
|
||||
Release: 1%{?dist}
|
||||
License: GPLv3+
|
||||
URL: https://www.nano-editor.org
|
||||
Source: https://www.nano-editor.org/dist/v2.7/%{name}-%{version}.tar.gz
|
||||
Source: https://www.nano-editor.org/dist/v2.8/%{name}-%{version}.tar.gz
|
||||
Source2: nanorc
|
||||
|
||||
# http://lists.gnu.org/archive/html/nano-devel/2010-08/msg00005.html
|
||||
Patch2: 0002-use-futimens-if-available-instead-of-utime.patch
|
||||
|
||||
BuildRequires: file-devel
|
||||
BuildRequires: gettext-devel
|
||||
BuildRequires: git
|
||||
|
|
@ -27,14 +24,10 @@ GNU nano is a small and friendly text editor.
|
|||
%prep
|
||||
%autosetup -S git
|
||||
|
||||
# do not run autotools, we have already reflected the configure.ac
|
||||
# changes in configure and config.h.in
|
||||
touch -c aclocal.m4 config.h.in configure Makefile.in
|
||||
|
||||
%build
|
||||
mkdir build
|
||||
cd build
|
||||
ln -s ../configure
|
||||
%global _configure ../configure
|
||||
%configure
|
||||
make %{?_smp_mflags}
|
||||
|
||||
|
|
@ -85,6 +78,22 @@ exit 0
|
|||
%{_datadir}/nano
|
||||
|
||||
%changelog
|
||||
* Mon May 22 2017 Kamil Dudka <kdudka@redhat.com> - 2.8.4-1
|
||||
- new upstream release
|
||||
|
||||
* Thu May 18 2017 Kamil Dudka <kdudka@redhat.com> - 2.8.3-1
|
||||
- new upstream release
|
||||
|
||||
* Thu May 04 2017 Kamil Dudka <kdudka@redhat.com> - 2.8.2-1
|
||||
- new upstream release
|
||||
|
||||
* Wed Apr 12 2017 Kamil Dudka <kdudka@redhat.com> - 2.8.1-1
|
||||
- new upstream release
|
||||
|
||||
* Tue Apr 04 2017 Kamil Dudka <kdudka@redhat.com> - 2.8.0-1
|
||||
- use upstream patch to prevent symlink attack while creating a backup
|
||||
- new upstream release
|
||||
|
||||
* Thu Feb 23 2017 Kamil Dudka <kdudka@redhat.com> - 2.7.5-1
|
||||
- new upstream release
|
||||
|
||||
|
|
|
|||
2
sources
2
sources
|
|
@ -1 +1 @@
|
|||
SHA512 (nano-2.7.5.tar.gz) = a5332a361c4d0d9d0a77ebb11cdcffa976bee4981d5665b2732a9e6d7a2997566d9345332f2e6e5cb74f0a81be4413f54ca8f719962ab10b32d7ec1c9271973c
|
||||
SHA512 (nano-2.8.4.tar.gz) = bbcaf710fdb5f403812b584a182ee472421d65c076f5fa2d538603c4cda8292485010157a2670e9890fcffc29d7db5c7334334d54d14f4e154b9bc3fe1ee919c
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue