summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorChris Buechler <cmb@pfsense.org>2016-02-09 15:56:37 -0600
committerChris Buechler <cmb@pfsense.org>2016-02-09 15:56:37 -0600
commitfd4dbabc09ddd265f78db8140bdac688651f3575 (patch)
tree7522e3f4ab0c3dc697857d31c86207a8728b9683 /src
parent8283e679c2fdf0ae4d918655c9feb0ade3351780 (diff)
downloadpfsense-fd4dbabc09ddd265f78db8140bdac688651f3575.zip
pfsense-fd4dbabc09ddd265f78db8140bdac688651f3575.tar.gz
Return false in download_file rather than the failed status code when a download fails. Return would always evaluate to true previously though other parts of the code expect a false value when a download fails. related to Ticket #5848
Diffstat (limited to 'src')
-rw-r--r--src/etc/inc/pfsense-utils.inc8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/etc/inc/pfsense-utils.inc b/src/etc/inc/pfsense-utils.inc
index 3db6452..07364f2 100644
--- a/src/etc/inc/pfsense-utils.inc
+++ b/src/etc/inc/pfsense-utils.inc
@@ -1683,7 +1683,13 @@ function download_file($url, $destination, $verify_ssl = true, $connect_timeout
$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
fclose($fp);
curl_close($ch);
- return ($http_code == 200) ? true : $http_code;
+ if ($http_code == 200) {
+ return true;
+ } else {
+ log_error("Download file failed with status code $http_code. URL: $url");
+ unlink_if_exists($destination);
+ return false;
+ }
}
function download_file_with_progress_bar($url_file, $destination_file, $readbody = 'read_body', $connect_timeout = 5, $timeout = 0) {
OpenPOWER on IntegriCloud