Exit with exit code 0 by default, unless error-on-warnings is being used

This commit is contained in:
mboelen 2016-04-25 10:18:09 +02:00
parent a3075d2e8f
commit eae8ef99a4
3 changed files with 14 additions and 1 deletions

View File

@ -76,6 +76,7 @@ unset LANG
DB2_RUNNING=0 DB2_RUNNING=0
DISCOVERED_BINARIES="" DISCOVERED_BINARIES=""
DOCKER_DAEMON_RUNNING=0 DOCKER_DAEMON_RUNNING=0
ERROR_ON_WARNINGS=0
FILEVALUE="" FILEVALUE=""
FIND="" FIND=""
FIREWALL_ACTIVE=0 FIREWALL_ACTIVE=0

View File

@ -99,6 +99,13 @@
fi fi
;; ;;
# Show non-zero exit code when errors are found
error-on-warnings)
if [ "${VALUE}" = "yes" -o "${VALUE}" = "true" -o ${VALUE} = "1" ]; then
ERROR_ON_WARNINGS=1
fi
;;
# Skip FreeBSD port audit # Skip FreeBSD port audit
freebsd_skip_portaudit) freebsd_skip_portaudit)
LogText "Option set: Skip FreeBSD portaudit" LogText "Option set: Skip FreeBSD portaudit"

5
lynis
View File

@ -986,10 +986,15 @@ ${NORMAL}
# Clean exit (Delete PID file) # Clean exit (Delete PID file)
if [ ${TOTAL_WARNINGS} -gt 0 ]; then if [ ${TOTAL_WARNINGS} -gt 0 ]; then
# Use exit code 78 if we found any warnings (and enabled)
if [ ${ERROR_ON_WARNINGS} -eq 1 ]; then
ExitCustom 78 ExitCustom 78
else else
ExitClean ExitClean
fi fi
else
ExitClean
fi
# The End # The End