]> git.wh0rd.org Git - nano.git/commitdiff
* files.c (write_file): Check exit code of fclose(), since in certain out of space...
authorChris Allegretta <chrisa@asty.org>
Sat, 16 Aug 2008 23:54:15 +0000 (23:54 +0000)
committerChris Allegretta <chrisa@asty.org>
Sat, 16 Aug 2008 23:54:15 +0000 (23:54 +0000)
  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

ChangeLog
src/files.c

index 272c86f22a1ab200ecb2793a299dfe878fd65d4d..6d51d3900b9abb99d03fcf22a10a292d02d5f2a7 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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
 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,
index 6c898640020d71e1e729bc6a26141d21749a61a4..e589f619f8d9350effcb7c1fedcf2b981a5fd79a 100644 (file)
@@ -1728,8 +1728,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) {