Add Postgres support to -starttls
[openssl.git] / apps / engine.c
index c98839a9fcfa042b7cb14e1d71aaa2908524521e..da1d91898bab20e1a301309ab7b1b3236dd9fb59 100644 (file)
@@ -26,7 +26,7 @@ typedef enum OPTION_choice {
     OPT_V = 100, OPT_VV, OPT_VVV, OPT_VVVV
 } OPTION_CHOICE;
 
-OPTIONS engine_options[] = {
+const OPTIONS engine_options[] = {
     {OPT_HELP_STR, 1, '-', "Usage: %s [options] engine...\n"},
     {OPT_HELP_STR, 1, '-',
         "  engine... Engines to load\n"},
@@ -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);