Resolves: #1186384 - additional fixes to the file locking feature of nano
This commit is contained in:
parent
967942c742
commit
4ff1398eed
@ -1,7 +1,7 @@
|
||||
From 131d4b0988f319736bb36760cee300934bf9bc12 Mon Sep 17 00:00:00 2001
|
||||
From: astyanax <astyanax@ac9c2fa3-95a5-41e5-9206-2167041ecc6c>
|
||||
Date: Wed, 14 Jan 2015 02:36:30 +0000
|
||||
Subject: [PATCH 1/3] 2015-01-13 Chris Allegretta <chrisa@asty.org> *
|
||||
Subject: [PATCH 1/6] 2015-01-13 Chris Allegretta <chrisa@asty.org> *
|
||||
src/files.c (open_buffer): Check here for locking and properly handle
|
||||
choosing to not open a file when locked instead of in open_file(). Fixes
|
||||
Savannah bug 42373 reported by Benno Schulenberg
|
||||
@ -66,7 +66,7 @@ index a195e6f..e027d69 100644
|
||||
From f47060c02f57279445281e9f23079f2bdccdca3a Mon Sep 17 00:00:00 2001
|
||||
From: astyanax <astyanax@ac9c2fa3-95a5-41e5-9206-2167041ecc6c>
|
||||
Date: Tue, 20 Jan 2015 06:15:34 +0000
|
||||
Subject: [PATCH 2/3] Take 2 at file locking fixes. New args to close_buffer()
|
||||
Subject: [PATCH 2/6] Take 2 at file locking fixes. New args to close_buffer()
|
||||
and switch_to_prevnext_buffer() to support message passthrough when trying to
|
||||
lock files using multibuffer.
|
||||
|
||||
@ -300,7 +300,7 @@ index 20f1fdb..579e6cf 100644
|
||||
From 7fa511ffbd45975e0638ea3497b49081f99c4bc9 Mon Sep 17 00:00:00 2001
|
||||
From: Kamil Dudka <kdudka@redhat.com>
|
||||
Date: Mon, 26 Jan 2015 14:55:39 +0100
|
||||
Subject: [PATCH 3/3] avoid writing uninitialized bytes to the lock file
|
||||
Subject: [PATCH 3/6] avoid writing uninitialized bytes to the lock file
|
||||
|
||||
The call to null_at() would not initialize the buffer:
|
||||
|
||||
@ -336,3 +336,88 @@ index faa2e62..1d0f0a8 100644
|
||||
--
|
||||
2.1.0
|
||||
|
||||
|
||||
From 0a7248ead64691a1f5f33dd1c7a4a55889110a92 Mon Sep 17 00:00:00 2001
|
||||
From: Kamil Dudka <kdudka@redhat.com>
|
||||
Date: Tue, 27 Jan 2015 17:40:02 +0100
|
||||
Subject: [PATCH 4/6] do_lockfile: make sure that lockprog and lockuser are
|
||||
terminated
|
||||
|
||||
strncpy() does not guarantee that on its own!
|
||||
---
|
||||
src/files.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/files.c b/src/files.c
|
||||
index 1d0f0a8..4468b4a 100644
|
||||
--- a/src/files.c
|
||||
+++ b/src/files.c
|
||||
@@ -253,7 +253,7 @@ int do_lockfile(const char *filename)
|
||||
+ strlen(locking_suffix) + 3;
|
||||
char *lockfilename = charalloc(lockfilesize);
|
||||
char *lockfiledir = NULL;
|
||||
- char lockprog[12], lockuser[16];
|
||||
+ static char lockprog[11], lockuser[17];
|
||||
struct stat fileinfo;
|
||||
int lockfd, lockpid;
|
||||
|
||||
--
|
||||
2.1.0
|
||||
|
||||
|
||||
From f3e979d92659d19eb1f67c75f728cb979061901d Mon Sep 17 00:00:00 2001
|
||||
From: Kamil Dudka <kdudka@redhat.com>
|
||||
Date: Tue, 27 Jan 2015 17:30:28 +0100
|
||||
Subject: [PATCH 5/6] do_lockfile: avoid printing wrong PID in status bar
|
||||
|
||||
... due to treating serialized PID bytes as singed integers
|
||||
|
||||
Bug: https://bugzilla.redhat.com/1186384
|
||||
Reported-by: Don Swaner
|
||||
---
|
||||
src/files.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/files.c b/src/files.c
|
||||
index 4468b4a..8c832ff 100644
|
||||
--- a/src/files.c
|
||||
+++ b/src/files.c
|
||||
@@ -284,7 +284,7 @@ int do_lockfile(const char *filename)
|
||||
return -1;
|
||||
}
|
||||
strncpy(lockprog, &lockbuf[2], 10);
|
||||
- lockpid = lockbuf[25] * 256 + lockbuf[24];
|
||||
+ lockpid = (unsigned char)lockbuf[25] * 256 + (unsigned char)lockbuf[24];
|
||||
strncpy(lockuser, &lockbuf[28], 16);
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "lockpid = %d\n", lockpid);
|
||||
--
|
||||
2.1.0
|
||||
|
||||
|
||||
From a7f011d98358cd8dc0566494c51b8e37269b6752 Mon Sep 17 00:00:00 2001
|
||||
From: Kamil Dudka <kdudka@redhat.com>
|
||||
Date: Tue, 27 Jan 2015 17:27:44 +0100
|
||||
Subject: [PATCH 6/6] write_filelock: do not trim nano version
|
||||
|
||||
... as snprintf() counts the trailing zero into the size limit
|
||||
---
|
||||
src/files.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/files.c b/src/files.c
|
||||
index 8c832ff..18be123 100644
|
||||
--- a/src/files.c
|
||||
+++ b/src/files.c
|
||||
@@ -200,7 +200,7 @@ int write_lockfile(const char *lockfilename, const char *origfilename, bool modi
|
||||
lockdata[1] = 0x30;
|
||||
lockdata[24] = mypid % 256;
|
||||
lockdata[25] = mypid / 256;
|
||||
- snprintf(&lockdata[2], 10, "nano %s", VERSION);
|
||||
+ snprintf(&lockdata[2], 11, "nano %s", VERSION);
|
||||
strncpy(&lockdata[28], mypwuid->pw_name, 16);
|
||||
strncpy(&lockdata[68], myhostname, 31);
|
||||
strncpy(&lockdata[108], origfilename, 768);
|
||||
--
|
||||
2.1.0
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
Summary: A small text editor
|
||||
Name: nano
|
||||
Version: 2.3.6
|
||||
Release: 5%{?dist}
|
||||
Release: 6%{?dist}
|
||||
License: GPLv3+
|
||||
Group: Applications/Editors
|
||||
URL: http://www.nano-editor.org
|
||||
@ -93,6 +93,9 @@ exit 0
|
||||
%{_datadir}/nano
|
||||
|
||||
%changelog
|
||||
* Tue Jan 27 2015 Kamil Dudka <kdudka@redhat.com> - 2.3.6-6
|
||||
- additional fixes to the file locking feature of nano (#1186384)
|
||||
|
||||
* Mon Jan 26 2015 Kamil Dudka <kdudka@redhat.com> - 2.3.6-5
|
||||
- fix the file locking feature of nano (#1183320)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user