* files.c (write_file): Check exit code of fclose(), since in certain out of space conditions the OS will

happily report successful fwrite()s until you try and close the file.  Fix for Savannah bug
	  #24000: no free space on partition - nano claims successful write - file empty 



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4304 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
master
Chris Allegretta 2008-08-16 23:54:15 +00:00
parent 93f2ea1194
commit 2cc58882f6
2 changed files with 10 additions and 2 deletions

View File

@ -1,3 +1,8 @@
2008-08-08 Chris Allegretta <chrisa@asty.org>
* files.c (write_file): Check exit code of fclose(), since in certain out of space conditions the OS will
happily report successful fwrite()s until you try and close the file. Fix for Savannah bug
#24000: no free space on partition - nano claims successful write - file empty
GNU nano 2.1.4 - 2008.08.09 GNU nano 2.1.4 - 2008.08.09
2008-08-08 Chris Allegretta <chrisa@asty.org> 2008-08-08 Chris Allegretta <chrisa@asty.org>
* files.c (write_file): Do not go on and attempt to write the main file if writing the backup file failed, * files.c (write_file): Do not go on and attempt to write the main file if writing the backup file failed,

View File

@ -1728,8 +1728,11 @@ bool write_file(const char *name, FILE *f_open, bool tmp, append_type
strerror(errno)); strerror(errno));
goto cleanup_and_exit; goto cleanup_and_exit;
} }
} else } else if (fclose(f) != 0) {
fclose(f); statusbar(_("Error writing %s: %s"), realname,
strerror(errno));
goto cleanup_and_exit;
}
if (!tmp && append == OVERWRITE) { if (!tmp && append == OVERWRITE) {
if (!nonamechange) { if (!nonamechange) {