summaryrefslogtreecommitdiff
path: root/mk
diff options
context:
space:
mode:
authorobache <obache@pkgsrc.org>2007-08-04 15:00:29 +0000
committerobache <obache@pkgsrc.org>2007-08-04 15:00:29 +0000
commit1d2a0b073b17c680edd3a1e4e96fa9779195c447 (patch)
tree5fe9556f9b83783ac80fadd2bc03df56b6858aa4 /mk
parent570236364e06a4aa47167ce55964e8dd7c13e9a0 (diff)
downloadpkgsrc-1d2a0b073b17c680edd3a1e4e96fa9779195c447.tar.gz
Move ${DISTDIR} write permission check to just before really need to write.
Patch provided by Aleksej Saushev in PR 36473.
Diffstat (limited to 'mk')
-rwxr-xr-xmk/fetch/fetch14
1 files changed, 7 insertions, 7 deletions
diff --git a/mk/fetch/fetch b/mk/fetch/fetch
index 38f86b792cd..784ba1b4200 100755
--- a/mk/fetch/fetch
+++ b/mk/fetch/fetch
@@ -1,6 +1,6 @@
#!/bin/sh
#
-# $NetBSD: fetch,v 1.8 2007/01/18 10:51:48 rillig Exp $
+# $NetBSD: fetch,v 1.9 2007/08/04 15:00:29 obache Exp $
#
# Copyright (c) 2006 The NetBSD Foundation, Inc.
# All rights reserved.
@@ -171,12 +171,6 @@ if ${TEST} -n "$distinfo" && ${TEST} ! -f "$distinfo"; then
exit 1
fi
-${TEST} -d $fetchdir || ${MKDIR} -p $fetchdir 2>/dev/null
-if ${TEST} ! -w $fetchdir; then
- ${ECHO} 1>&2 "$self: Cannot write to `cd $fetchdir && pwd`"
- exit 1
-fi
-
# Compute the expected size of the fetched file.
distsize=
distunits=
@@ -223,6 +217,12 @@ if verify_file $path; then
exit 0
fi
+${TEST} -d $fetchdir || ${MKDIR} -p $fetchdir 2>/dev/null
+if ${TEST} ! -w $fetchdir; then
+ ${ECHO} 1>&2 "$self: Cannot write to `cd $fetchdir && pwd`"
+ exit 1
+fi
+
# Set the name of the output file. In the "resume" case, we initialize
# the fetch loop by ensuring that the temporary output file already
# exists.