Move ${DISTDIR} write permission check to just before really need to write.

Patch provided by Aleksej Saushev in PR 36473.
This commit is contained in:
obache 2007-08-04 15:00:29 +00:00
parent 570236364e
commit 1d2a0b073b

View file

@ -1,6 +1,6 @@
#!/bin/sh #!/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. # Copyright (c) 2006 The NetBSD Foundation, Inc.
# All rights reserved. # All rights reserved.
@ -171,12 +171,6 @@ if ${TEST} -n "$distinfo" && ${TEST} ! -f "$distinfo"; then
exit 1 exit 1
fi 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. # Compute the expected size of the fetched file.
distsize= distsize=
distunits= distunits=
@ -223,6 +217,12 @@ if verify_file $path; then
exit 0 exit 0
fi 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 # Set the name of the output file. In the "resume" case, we initialize
# the fetch loop by ensuring that the temporary output file already # the fetch loop by ensuring that the temporary output file already
# exists. # exists.