From 3ee1ef6443a6101ca610487a4c7d8bf41f215558 Mon Sep 17 00:00:00 2001 From: Michael Pyne Date: Mon, 7 Mar 2011 19:13:02 -0500 Subject: [PATCH] Don't allow partial file downloads. This is particularly annoying with the proj.k.o support, as a half-downloaded XML file is 100% invalid, and will cause XML::Parser to throw an exception. --- kdesrc-build | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/kdesrc-build b/kdesrc-build index 3b7af1b..b695b3d 100755 --- a/kdesrc-build +++ b/kdesrc-build @@ -1753,6 +1753,14 @@ sub download_http_file return 0; }; + # Don't allow partial downloads + local $SIG{'INT'} = sub { + unlink($filename); + close OUTPUT; + $conn->close(); + die make_exception('Runtime', "Interrupted while downloading $filename"); + }; + my ($buf, $result); while (1) { @@ -1763,7 +1771,7 @@ sub download_http_file $conn->close(); close OUTPUT; - safe_unlink($filename); + unlink($filename); return 0; }