summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--includes/file.inc12
1 files changed, 8 insertions, 4 deletions
diff --git a/includes/file.inc b/includes/file.inc
index 8126a772b..6c29a1725 100644
--- a/includes/file.inc
+++ b/includes/file.inc
@@ -442,11 +442,15 @@ function file_transfer($source, $headers) {
$source = file_create_path($source);
// Transfer file in 1024 byte chunks to save memory usage.
- $fd = fopen($source, 'rb');
- while (!feof($fd)) {
- print fread($fd, 1024);
+ if ($fd = fopen($source, 'rb')) {
+ while (!feof($fd)) {
+ print fread($fd, 1024);
+ }
+ fclose($fd);
+ }
+ else {
+ drupal_not_found();
}
- fclose($fd);
exit();
}