Allow pfctl -[de] to return 1

If pf is already enabled or disabled and we try to enable/disable it again, it returns 1.
This commit is contained in:
Jake Guffey 2012-09-19 16:42:15 -04:00
parent 08aa7d8e83
commit 995265d4a6
1 changed files with 4 additions and 1 deletions

View File

@ -29,6 +29,8 @@ rcvar=$(cat "$__object/explorer/rcvar")
cat <<EOF
if [ -f "${rcvar}.old" ]; then # rcvar.old exists, we must need to disable pf
# Disable pf
# If it already is disabled, pfctl -d returns 1, go on with life
pfctl -d
# Cleanup
rm -f "${rcvar}.old
@ -36,7 +38,8 @@ if [ -f "${rcvar}.old" ]; then # rcvar.old exists, we must need to disable pf
[ -f "${rcvar}" ] && rm -f "${rcvar}"
elif [ -f "${rcvar}.new" ]; then # rcvar.new exists, we must need to apply it
# Ensure that pf is enabled in the first place
pfctl -e
# If it already is enabled, pfctl -e returns 1, go on with life
pfctl -e || true
pfctl -f "${rcvar}"
ret="$?"
# Cleanup