From: mtortonesi Date: Tue, 24 Jan 2006 13:36:24 +0000 (-0800) Subject: [svn] Remove output document in case of download problems when -O and --quiet are... X-Git-Tag: v1.13~694 X-Git-Url: http://sjero.net/git/?p=wget;a=commitdiff_plain;h=f1b726490e64bb0b8fd289c3af105a5369674349 [svn] Remove output document in case of download problems when -O and --quiet are given. --- diff --git a/src/init.c b/src/init.c index 820f84db..26b52a57 100644 --- a/src/init.c +++ b/src/init.c @@ -1427,7 +1427,15 @@ cleanup (void) /* Free external resources, close files, etc. */ if (output_stream) - fclose (output_stream); + { + fclose (output_stream); + if (opt.output_document + && !(total_downloaded_bytes > 0)) + { + unlink (opt.output_document); + } + } + /* No need to check for error because Wget flushes its output (and checks for errors) after any data arrives. */