shutdown: ignore a modified buffer when in view mode

In view mode it should be impossible to modify any buffer, but...
when (through some bug) the user did succeed in modifying a buffer,
this should not lead to writing out this modified buffer to disk.

Had this safety stop been present earlier, it would have prevented
the second part of https://savannah.gnu.org/bugs/?63616.
This commit is contained in:
Benno Schulenberg 2023-02-08 17:15:05 +01:00
parent 078d612b9e
commit 0662fc4d42

View File

@ -303,7 +303,7 @@ void do_exit(void)
/* When unmodified, simply close. Else, when doing automatic saving
* and the file has a name, simply save. Otherwise, ask the user. */
if (!openfile->modified)
if (!openfile->modified || ISSET(VIEW_MODE))
choice = NO;
else if (ISSET(SAVE_ON_EXIT) && openfile->filename[0] != '\0')
choice = YES;