From: Chris Allegretta Date: Sat, 3 Apr 2010 02:39:18 +0000 (+0000) Subject: 2010-04-02 Chris Allegretta X-Git-Tag: v2.2.4~13 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=cdb5b16198528aeceff0b4e23b047cb6e2fbffa4;p=nano.git 2010-04-02 Chris Allegretta * files.c (do_writeout): Expand modification check to include both the original file's device ID and inode number as reasons to warn the user that the file has been modified. Based on security article on nano by Dan Rosenberg. git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4490 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- diff --git a/ChangeLog b/ChangeLog index 0437b363..3c4edf96 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2010-04-02 Chris Allegretta + * files.c (do_writeout): Expand modification check to include both the + original file's device ID and inode number as reasons to warn the + user that the file has been modified. Based on security article on nano + by Dan Rosenberg. + 2010-03-21 Chris Allegretta * nano.c (page_stdin et al): Don't attempt to reset/reopen the terminal settings when reading stdin if it was aborted with SIGINT. May fix Savannah diff --git a/src/files.c b/src/files.c index 5e922a4d..8e63903a 100644 --- a/src/files.c +++ b/src/files.c @@ -2126,7 +2126,8 @@ bool do_writeout(bool exiting) } #ifndef NANO_TINY - if (name_exists && openfile->current_stat && openfile->current_stat->st_mtime < st.st_mtime) { + 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)