in do_writeout(), fix a segfault when we can't get the full path of

either the filename we want to save under or the original filename


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3997 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
This commit is contained in:
David Lawrence Ramsey 2006-12-14 20:03:30 +00:00
parent b513778b56
commit 4c19415ecf
2 changed files with 6 additions and 1 deletions

View File

@ -10,6 +10,10 @@ CVS code -
nulls. (DLR)
write_file()
- Properly handle filenames that contain nulls. (DLR)
do_writeout()
- Fix a segfault when we can't get the full path of either the
filename we want to save under or the original filename. (DLR,
found by Mike Frysinger)
- nano.h:
- Rename NANO_ALT_REPLACE_KEY to NANO_REPLACE_ALTKEY, for
consistency. (DLR)

View File

@ -1897,7 +1897,8 @@ int do_writeout(bool exiting)
unsunder(answer, answer_len);
full_filename = get_full_path(openfile->filename);
different_name = (strcmp(full_answer,
different_name = (full_answer != NULL &&
full_filename != NULL && strcmp(full_answer,
full_filename) != 0);
free(full_filename);