aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2014-05-26 13:11:59 +1200
committerTom Ryder <tom@sanctum.geek.nz>2014-05-26 13:11:59 +1200
commit45ddbe84d77f52d9ffe8f71096211dbbe5b1f606 (patch)
tree5325353daa326b14ec94e0023a9d8084281ed0af
parentDefensive umask (diff)
downloadnwatch-45ddbe84d77f52d9ffe8f71096211dbbe5b1f606.tar.gz
nwatch-45ddbe84d77f52d9ffe8f71096211dbbe5b1f606.zip
Don't create parent directories
Possible security implications
-rwxr-xr-xbin/nwatch8
1 files changed, 5 insertions, 3 deletions
diff --git a/bin/nwatch b/bin/nwatch
index c1b3e5a..c89c886 100755
--- a/bin/nwatch
+++ b/bin/nwatch
@@ -34,9 +34,11 @@ hostlist=${1:?}
cachedir=${2:?}
latest=$cachedir/${self}.scan.latest
-# Create the cachedir or give up
-if ! mkdir -p "$cachedir" ; then
- exit
+# If the cachedir doesn't exist, attempt to create it, otherwise give up
+if [[ -d "$cachedir" ]] ; then
+ if ! mkdir -- "$cachedir" ; then
+ exit
+ fi
fi
# Today's values