From 6cf05d487fcaa14525e9c8de8c621912533636da Mon Sep 17 00:00:00 2001 From: Chris Allegretta Date: Thu, 14 Jan 2010 06:32:37 +0000 Subject: [PATCH] 2010-01-14 Chris Allegretta * 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 --- ChangeLog | 4 ++++ src/files.c | 3 ++- src/nano.c | 1 + 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 9f22de5b..d0e64ad4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2010-01-14 Chris Allegretta + * files.c (do_writeout): Fix for crash / incorrect external modification warning + due to earlier fix in r4467. + 2010-01-12 Chris Allegretta * 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 index dd3b92cc..5e922a4d 100644 --- 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 index d6a21d10..e8febbb8 100644 --- 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 -- 2.39.5