diff --git a/ChangeLog b/ChangeLog index 9f22de5b3ff78eca1f7b5ce2d039c618200dfa3b..d0e64ad4d8bd5f04988390f075ae63b569521e3a 100644 --- 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 index dd3b92cced8018b37e31f1158c883264b524cf7d..5e922a4d682e770795afb2a971a87041d9ac71ec 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 d6a21d107fe69bf5082dadd695ca4fd238b3f83d..e8febbb892071ae38a54b5222ef154da8e394101 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