summaryrefslogtreecommitdiffstats
path: root/apps/engine.c
diff options
context:
space:
mode:
authorRichard Levitte <levitte@openssl.org>2016-07-19 08:57:01 +0200
committerRichard Levitte <levitte@openssl.org>2016-08-04 16:57:49 +0200
commit9e64457d1ed6200228a930ab14c5c5e68a666d1e (patch)
treecf42a7027df83e2a665ba900ddd8e5f1f5686767 /apps/engine.c
parent5fc2c6896d5050735c7d99dc80275c72fc58c49c (diff)
Have 'openssl engine' exit with non-zero when some engine fails to load
Reviewed-by: Rich Salz <rsalz@openssl.org>
Diffstat (limited to 'apps/engine.c')
-rw-r--r--apps/engine.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/apps/engine.c b/apps/engine.c
index c98839a9fc..ffd3137426 100644
--- a/apps/engine.c
+++ b/apps/engine.c
@@ -342,6 +342,7 @@ int engine_main(int argc, char **argv)
}
}
+ ret = 0;
for (i = 0; i < sk_OPENSSL_CSTRING_num(engines); i++) {
const char *id = sk_OPENSSL_CSTRING_value(engines, i);
if ((e = ENGINE_by_id(id)) != NULL) {
@@ -424,11 +425,14 @@ int engine_main(int argc, char **argv)
if ((verbose > 0) && !util_verbose(e, verbose, out, indent))
goto end;
ENGINE_free(e);
- } else
+ } else {
ERR_print_errors(bio_err);
+ /* because exit codes above 127 have special meaning on Unix */
+ if (++ret > 127)
+ ret = 127;
+ }
}
- ret = 0;
end:
ERR_print_errors(bio_err);