]> sjero.net Git - wget/commitdiff
Check for fclose errors.
authorGiuseppe Scrivano <gscrivano@gnu.org>
Sun, 17 Jun 2012 20:24:32 +0000 (22:24 +0200)
committerGiuseppe Scrivano <gscrivano@gnu.org>
Sun, 17 Jun 2012 20:24:32 +0000 (22:24 +0200)
src/ChangeLog
src/exits.c
src/init.c
src/wget.h

index b3937051cbbd22915d413de98fd55eb4a816378e..7b2bde0ec8a040088421619075e65291b7e40b7d 100644 (file)
@@ -1,3 +1,10 @@
+2012-06-17  Giuseppe Scrivano  <gscrivano@gnu.org>
+
+       * wget.h: Define `CLOSEFAILED'.
+       * init.c: Include "exits.h".
+       (cleanup): Check `fclose' failure.
+       * exits.c (get_status_for_err): Handle `CLOSEFAILED'.
+
 2012-06-16  Giuseppe Scrivano  <gscrivano@gnu.org>
 
        * main.c (main): Move some cleanup related function to...
 2012-06-16  Giuseppe Scrivano  <gscrivano@gnu.org>
 
        * main.c (main): Move some cleanup related function to...
index 3d846b56be55f5afd185939cb61cc6b06e7a8c7a..2233cdc1b5f4015947779f887b9284f829efef97 100644 (file)
@@ -60,7 +60,7 @@ get_status_for_err (uerr_t err)
     case RETROK:
       return WGET_EXIT_SUCCESS;
     case FOPENERR: case FOPEN_EXCL_ERR: case FWRITEERR: case WRITEFAILED:
     case RETROK:
       return WGET_EXIT_SUCCESS;
     case FOPENERR: case FOPEN_EXCL_ERR: case FWRITEERR: case WRITEFAILED:
-    case UNLINKERR:
+    case UNLINKERR: case CLOSEFAILED:
       return WGET_EXIT_IO_FAIL;
     case NOCONERROR: case HOSTERR: case CONSOCKERR: case CONERROR:
     case CONSSLERR: case CONIMPOSSIBLE: case FTPRERR: case FTPINVPASV:
       return WGET_EXIT_IO_FAIL;
     case NOCONERROR: case HOSTERR: case CONSOCKERR: case CONERROR:
     case CONSSLERR: case CONIMPOSSIBLE: case FTPRERR: case FTPINVPASV:
index 40b62b2715c44882603c004c0cb54e9222d55feb..4188ca16c1b66795f896baa771a6caa836af2437 100644 (file)
@@ -30,6 +30,7 @@ shall include the source code for the parts of OpenSSL used as well
 as that of the covered work.  */
 
 #include "wget.h"
 as that of the covered work.  */
 
 #include "wget.h"
+#include "exits.h"
 
 #include <stdio.h>
 #include <stdlib.h>
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -1682,7 +1683,9 @@ cleanup (void)
   log_close ();
 
   if (output_stream)
   log_close ();
 
   if (output_stream)
-    fclose (output_stream);
+    if (fclose (output_stream) == EOF)
+      inform_exit_status (CLOSEFAILED);
+
   /* No need to check for error because Wget flushes its output (and
      checks for errors) after any data arrives.  */
 
   /* No need to check for error because Wget flushes its output (and
      checks for errors) after any data arrives.  */
 
index ee315b6f81aab54c806250040f0218073cc0f40e..ca4a702d11f56558be952ac0ed1ec72c407a6502 100644 (file)
@@ -353,7 +353,7 @@ typedef enum
   PROXERR,
   /* 50  */
   AUTHFAILED, QUOTEXC, WRITEFAILED, SSLINITFAILED, VERIFCERTERR,
   PROXERR,
   /* 50  */
   AUTHFAILED, QUOTEXC, WRITEFAILED, SSLINITFAILED, VERIFCERTERR,
-  UNLINKERR, NEWLOCATION_KEEP_POST,
+  UNLINKERR, NEWLOCATION_KEEP_POST, CLOSEFAILED,
 
   WARC_ERR, WARC_TMP_FOPENERR, WARC_TMP_FWRITEERR
 } uerr_t;
 
   WARC_ERR, WARC_TMP_FOPENERR, WARC_TMP_FWRITEERR
 } uerr_t;