From f1b726490e64bb0b8fd289c3af105a5369674349 Mon Sep 17 00:00:00 2001 From: mtortonesi Date: Tue, 24 Jan 2006 05:36:24 -0800 Subject: [PATCH] [svn] Remove output document in case of download problems when -O and --quiet are given. --- src/init.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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. */