summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xsupport/download/dl-wrapper7
1 files changed, 6 insertions, 1 deletions
diff --git a/support/download/dl-wrapper b/support/download/dl-wrapper
index ce44752df0..38430738eb 100755
--- a/support/download/dl-wrapper
+++ b/support/download/dl-wrapper
@@ -56,8 +56,13 @@ main() {
# Legacy handling: check if the file already exists in the global
# download directory. If it does, hard-link it. If it turns out it
# was an incorrect download, we'd still check it below anyway.
+ # If we can neither link nor copy, fallback to doing a download.
+ # NOTE! This is not atomic, is subject to TOCTTOU, but the whole
+ # dl-wrapper runs under an flock, so we're safe.
if [ ! -e "${output}" -a -e "${old_dl_dir}/${filename}" ]; then
- ln "${old_dl_dir}/${filename}" "${output}"
+ ln "${old_dl_dir}/${filename}" "${output}" || \
+ cp "${old_dl_dir}/${filename}" "${output}" || \
+ true
fi
# If the output file already exists and:
OpenPOWER on IntegriCloud