commit 6cf05d487fcaa14525e9c8de8c621912533636da
parent 1a7a91b779359a04c3e6cec97794a5bfd72bf8e6
Author: Chris Allegretta <chrisa@asty.org>
Date: Thu, 14 Jan 2010 06:32:37 +0000
2010-01-14 Chris Allegretta <chrisa@asty.org>
* files.c (do_writeout): Fix for crash / incorrect external modification warning
due to earlier fix in r4467.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4474 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
Diffstat:
3 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/ChangeLog b/ChangeLog
@@ -1,3 +1,7 @@
+2010-01-14 Chris Allegretta <chrisa@asty.org>
+ * files.c (do_writeout): Fix for crash / incorrect external modification warning
+ due to earlier fix in r4467.
+
2010-01-12 Chris Allegretta <chrisa@asty.org>
* move.c (do_page_up, do_page_down): Fix issues with not enough scrolling down/up
and cursor centering.
diff --git a/src/files.c b/src/files.c
@@ -1504,7 +1504,7 @@ bool write_file(const char *name, FILE *f_open, bool tmp, append_type
* specified it interactively), use the info we just got from
* stat()ing or else we will chase null pointers when we do
* modtime checks, preserve file times, etc. during backup */
- if(openfile->current_stat == NULL)
+ if (openfile->current_stat == NULL && realexists)
openfile->current_stat = &st;
/* We backup only if the backup toggle is set, the file isn't
@@ -2125,6 +2125,7 @@ bool do_writeout(bool exiting)
}
}
#ifndef NANO_TINY
+
if (name_exists && openfile->current_stat && openfile->current_stat->st_mtime < st.st_mtime) {
i = do_yesno_prompt(FALSE,
_("File was modified since you opened it, continue saving ? "));
diff --git a/src/nano.c b/src/nano.c
@@ -517,6 +517,7 @@ openfilestruct *make_new_opennode(void)
newnode->filebot = NULL;
newnode->edittop = NULL;
newnode->current = NULL;
+ newnode->current_stat = NULL;
#ifndef NANO_TINY
newnode->last_action = OTHER;
#endif