Fix: notice() and warn() returned error in batch

Merge branch 'madmajestro-imrove-returncode-notice-and-warn'

This resolves a bug where the warn() and notice() functions would
produce a non-zero exit during batch mode operations.  This bug was
introduced by me in 09e2c3b.

Signed-off-by: Eric F Crist <ecrist@secure-computing.net>
This commit is contained in:
Eric F Crist 2020-05-12 22:15:47 -05:00
commit 2953817e45
No known key found for this signature in database
GPG Key ID: 72964219390D0D0E

View File

@ -262,7 +262,7 @@ Deprecated features:
# Wrapper around printf - clobber print since it's not POSIX anyway
# shellcheck disable=SC1117
print() { printf "%s\n" "$*"; }
print() { printf "%s\n" "$*" || exit 1; }
# Exit fatally with a message to stderr
# present even with EASYRSA_BATCH as these are fatal problems
@ -279,6 +279,8 @@ warn() {
[ ! "$EASYRSA_BATCH" ] && \
print "
$1" 1>&2
return 0
} # => warn()
# informational notices to stdout
@ -286,6 +288,8 @@ notice() {
[ ! "$EASYRSA_BATCH" ] && \
print "
$1"
return 0
} # => notice()
# yes/no case-insensitive match (operates on stdin pipe)