From: Chris Allegretta Date: Sun, 17 Aug 2008 00:10:34 +0000 (+0000) Subject: backport of Fix for Savnnah bug 24000: no free space on partition - nano claims... X-Git-Tag: v2.0.8~2 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=e92c28cf07cd43a64bd7149d6f0824b3457bcb2c;p=nano.git backport of Fix for Savnnah bug 24000: no free space on partition - nano claims successful write - file empty git-svn-id: svn://svn.savannah.gnu.org/nano/branches/nano_2_0_branch/nano@4305 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- diff --git a/ChangeLog b/ChangeLog index bd74f1a1..1494fa80 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2008-08-08 Chris Allegretta + * 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 + 2008-07-11 Mitsuya Shibata * text.c: Fix crashing in help menu when using certain locales (Savannah bug 23751) diff --git a/src/files.c b/src/files.c index bb556bf4..f4846360 100644 --- a/src/files.c +++ b/src/files.c @@ -1704,8 +1704,11 @@ bool write_file(const char *name, FILE *f_open, bool tmp, append_type strerror(errno)); goto cleanup_and_exit; } - } else - fclose(f); + } else if (fclose(f) != 0) { + statusbar(_("Error writing %s: %s"), realname, + strerror(errno)); + goto cleanup_and_exit; + } if (!tmp && append == OVERWRITE) { if (!nonamechange) {