From 83a0e9013e726a6318308716617b966991a65414 Mon Sep 17 00:00:00 2001 From: Chris Allegretta Date: Thu, 8 Apr 2010 02:22:53 +0000 Subject: [PATCH] 2010-04-02 Chris Allegretta * files.c (do_writeout): Previous fixes should not cause a crash when saving a new file. Discovered by Mike Frysinger . git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4494 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- ChangeLog | 4 ++++ src/files.c | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 08619413..f6664004 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2010-04-02 Chris Allegretta + * files.c (do_writeout): Previous fixes should not cause a crash + when saving a new file. Discovered by Mike Frysinger . + 2010-04-07 Chris Allegretta * doc/man/nano.1,nanorc.5: Add warnings about using backup mode as root due to the Dan Rosenberg security analysis. diff --git a/src/files.c b/src/files.c index 9a853360..58355fad 100644 --- a/src/files.c +++ b/src/files.c @@ -2136,8 +2136,8 @@ bool do_writeout(bool exiting) } #ifndef NANO_TINY - if (name_exists && openfile->current_stat && openfile->current_stat->st_mtime < st.st_mtime || - openfile->current_stat->st_dev != st.st_dev || openfile->current_stat->st_ino != st.st_ino) { + if (name_exists && (openfile->current_stat && openfile->current_stat->st_mtime < st.st_mtime || + openfile->current_stat->st_dev != st.st_dev || openfile->current_stat->st_ino != st.st_ino)) { i = do_yesno_prompt(FALSE, _("File was modified since you opened it, continue saving ? ")); if (i == 0 || i == -1) -- 2.39.5