aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2014-06-11 11:52:35 +1200
committerTom Ryder <tom@sanctum.geek.nz>2014-06-11 11:52:35 +1200
commitd7d5934b4d71cda53cae890752c681d23ef83961 (patch)
tree834a0dd5cf3eeb1b444e6c7507df68e239e4509b
parentCatch ndiff(1) error condition properly (diff)
downloadnwatch-d7d5934b4d71cda53cae890752c681d23ef83961.tar.gz
nwatch-d7d5934b4d71cda53cae890752c681d23ef83961.zip
Use explicit error codes for exit calls
Probably best not to rely on bash to carry the exit value forward correctly; clearer this way anyway
-rwxr-xr-xbin/nwatch6
1 files changed, 3 insertions, 3 deletions
diff --git a/bin/nwatch b/bin/nwatch
index 6a35f84..6aaa076 100755
--- a/bin/nwatch
+++ b/bin/nwatch
@@ -37,7 +37,7 @@ latest=$cachedir/${self}.scan.latest
# If the cachedir doesn't exist, attempt to create it, otherwise give up
if [[ ! -d "$cachedir" ]] ; then
if ! mkdir -- "$cachedir" ; then
- exit
+ exit 1
fi
fi
@@ -48,7 +48,7 @@ diff=$cachedir/${self}.diff.${date}
# Run the scan or give up
if ! nmap -v -T4 -sV -iL "$hostlist" -oA "$cache" >/dev/null ; then
- exit
+ exit 1
fi
# If the link to the XML file is legible, run the diff or give up
@@ -58,7 +58,7 @@ if [[ -r ${latest}.xml ]] ; then
# Because we always want a report, only exit if an actual error condition
# (1 means there's a meaningful diff in the scans)
if (($? == 2)) ; then
- exit
+ exit 1
fi
fi