1
0
mirror of https://github.com/moparisthebest/wget synced 2024-07-03 16:38:41 -04:00

Check for fclose errors.

This commit is contained in:
Giuseppe Scrivano 2012-06-17 22:24:32 +02:00
parent 6aa2a7cc98
commit ae0598df9b
4 changed files with 13 additions and 3 deletions

View 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> 2012-06-16 Giuseppe Scrivano <gscrivano@gnu.org>
* main.c (main): Move some cleanup related function to... * main.c (main): Move some cleanup related function to...

View File

@ -60,7 +60,7 @@ get_status_for_err (uerr_t err)
case RETROK: case RETROK:
return WGET_EXIT_SUCCESS; return WGET_EXIT_SUCCESS;
case FOPENERR: case FOPEN_EXCL_ERR: case FWRITEERR: case WRITEFAILED: case FOPENERR: case FOPEN_EXCL_ERR: case FWRITEERR: case WRITEFAILED:
case UNLINKERR: case UNLINKERR: case CLOSEFAILED:
return WGET_EXIT_IO_FAIL; return WGET_EXIT_IO_FAIL;
case NOCONERROR: case HOSTERR: case CONSOCKERR: case CONERROR: case NOCONERROR: case HOSTERR: case CONSOCKERR: case CONERROR:
case CONSSLERR: case CONIMPOSSIBLE: case FTPRERR: case FTPINVPASV: case CONSSLERR: case CONIMPOSSIBLE: case FTPRERR: case FTPINVPASV:

View File

@ -30,6 +30,7 @@ shall include the source code for the parts of OpenSSL used as well
as that of the covered work. */ as that of the covered work. */
#include "wget.h" #include "wget.h"
#include "exits.h"
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
@ -1682,7 +1683,9 @@ cleanup (void)
log_close (); log_close ();
if (output_stream) 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 /* No need to check for error because Wget flushes its output (and
checks for errors) after any data arrives. */ checks for errors) after any data arrives. */

View File

@ -353,7 +353,7 @@ typedef enum
PROXERR, PROXERR,
/* 50 */ /* 50 */
AUTHFAILED, QUOTEXC, WRITEFAILED, SSLINITFAILED, VERIFCERTERR, AUTHFAILED, QUOTEXC, WRITEFAILED, SSLINITFAILED, VERIFCERTERR,
UNLINKERR, NEWLOCATION_KEEP_POST, UNLINKERR, NEWLOCATION_KEEP_POST, CLOSEFAILED,
WARC_ERR, WARC_TMP_FOPENERR, WARC_TMP_FWRITEERR WARC_ERR, WARC_TMP_FOPENERR, WARC_TMP_FWRITEERR
} uerr_t; } uerr_t;