X-Git-Url: http://git.ipfire.org/?p=people%2Fstevee%2Fnetwork.git;a=blobdiff_plain;f=src%2Ffunctions%2Ffunctions.util;fp=src%2Ffunctions%2Ffunctions.util;h=39ad8613b6e4419c5ef97e86c900e63ac9d75383;hp=7379a9887de812acf0eb812ef2cb2b0b7d0091e4;hb=9532462fe04658d728ecbf263b586111f73fe2b2;hpb=fc1e91cca425c8e929df76dad4488066070879dd diff --git a/src/functions/functions.util b/src/functions/functions.util index 7379a988..39ad8613 100644 --- a/src/functions/functions.util +++ b/src/functions/functions.util @@ -469,14 +469,27 @@ assert() { local assertion="$@" if ! ${assertion}; then - error_log "Assertion '${assertion}' failed." backtrace - exit ${EXIT_ERROR_ASSERT} + + # End the program here + abort "Assertion failed: ${assertion}" fi return ${EXIT_OK} } +# Ends the program immediately without cleaning up +abort() { + local msg="$@" + + # Print message + if isset msg; then + log ERROR "${msg}" + fi + + exit ${EXIT_ERROR_ASSERT} +} + # This function checks, if the given argument is an assert error # exit code. If this is the case, the script will halt immediately. assert_check_retval() {