commit a7ae1766c068dbeba0e449881d0765bf52f635a2
parent faa46a3c71724a81c7df25ca88b28dfce89e65ff
Author: Benno Schulenberg <bensberg@justemail.net>
Date: Tue, 2 Aug 2016 17:11:50 +0200
locking: remove any lock files when dying
This fixes https://savannah.gnu.org/bugs/?48675.
Diffstat:
1 file changed, 10 insertions(+), 0 deletions(-)
diff --git a/src/nano.c b/src/nano.c
@@ -603,6 +603,12 @@ void die(const char *msg, ...)
vfprintf(stderr, msg, ap);
va_end(ap);
+#ifndef NANO_TINY
+ /* If the current buffer has a lockfile, remove it. */
+ if (ISSET(LOCKING) && openfile->lock_filename)
+ delete_lockfile(openfile->lock_filename);
+#endif
+
/* Save the current file buffer if it's been modified. */
if (openfile && openfile->modified) {
/* If we've partitioned the filestruct, unpartition it now. */
@@ -624,6 +630,10 @@ void die(const char *msg, ...)
while (tmp != openfile->next) {
openfile = openfile->next;
+#ifndef NANO_TINY
+ if (ISSET(LOCKING) && openfile->lock_filename)
+ delete_lockfile(openfile->lock_filename);
+#endif
/* Save the current file buffer if it's been modified. */
if (openfile->modified)
die_save_file(openfile->filename