EXIT() may mean return(). That's confusing, so let's have it really mean
authorRichard Levitte <levitte@openssl.org>
Tue, 3 Dec 2002 16:34:28 +0000 (16:34 +0000)
committerRichard Levitte <levitte@openssl.org>
Tue, 3 Dec 2002 16:34:28 +0000 (16:34 +0000)
exit() in whatever way works for the intended platform, and define
OPENSSL_EXIT() to have the old meaning (the name is of course because
it's only used in the openssl program)

35 files changed:
apps/asn1pars.c
apps/ca.c
apps/ciphers.c
apps/crl.c
apps/crl2p7.c
apps/dgst.c
apps/dh.c
apps/dhparam.c
apps/dsa.c
apps/dsaparam.c
apps/enc.c
apps/engine.c
apps/errstr.c
apps/gendh.c
apps/gendsa.c
apps/genrsa.c
apps/nseq.c
apps/ocsp.c
apps/openssl.c
apps/passwd.c
apps/pkcs12.c
apps/pkcs7.c
apps/rand.c
apps/req.c
apps/rsa.c
apps/s_client.c
apps/s_server.c
apps/s_time.c
apps/sess_id.c
apps/speed.c
apps/spkac.c
apps/verify.c
apps/version.c
apps/x509.c
e_os.h

index 8f178db851eb4d6b1d3b847f35c2d68cde379dd1..83674154053a5d209416722f3dd75cd2cfef098d 100644 (file)
@@ -332,6 +332,6 @@ end:
        if (osk != NULL) sk_free(osk);
        OBJ_cleanup();
        apps_shutdown();
-       EXIT(ret);
+       OPENSSL_EXIT(ret);
        }
 
index 811413df4aa487465e771b92bff53c1327a6108b..705c705c0acc2e4118353fa456f42da4cedfc67d 100644 (file)
--- a/apps/ca.c
+++ b/apps/ca.c
@@ -1647,7 +1647,7 @@ err:
        NCONF_free(conf);
        OBJ_cleanup();
        apps_shutdown();
-       EXIT(ret);
+       OPENSSL_EXIT(ret);
        }
 
 static void lookup_fail(char *name, char *tag)
index fe26ae8cd62504b13a891dbab4ee9a2e7ec57015..7c62fc5dc3394e3dea48a8db9d700db93bdc4806 100644 (file)
@@ -203,6 +203,6 @@ end:
        if (ssl != NULL) SSL_free(ssl);
        if (STDout != NULL) BIO_free_all(STDout);
        apps_shutdown();
-       EXIT(ret);
+       OPENSSL_EXIT(ret);
        }
 
index 00946b4d20fc2370cb9636ac9e41594a45e6af2f..c6089ace526189ee55cdb00df04e9a6cf09defb5 100644 (file)
@@ -377,7 +377,7 @@ end:
                X509_STORE_free(store);
        }
        apps_shutdown();
-       EXIT(ret);
+       OPENSSL_EXIT(ret);
        }
 
 static X509_CRL *load_crl(char *infile, int format)
index 8729068462baa840f934e5c13bac4d38c784767c..b2f2d121d56cb8739f32d6b9a6173051fdd98d55 100644 (file)
@@ -280,7 +280,7 @@ end:
        if (crl != NULL) X509_CRL_free(crl);
 
        apps_shutdown();
-       EXIT(ret);
+       OPENSSL_EXIT(ret);
        }
 
 /*
index c4bb7a106153bd31bcac32f0d044b721c490c4cd..280f79b4a23abaf5f1c3029642763bdc5dd7536f 100644 (file)
@@ -365,7 +365,7 @@ end:
        if(sigbuf) OPENSSL_free(sigbuf);
        if (bmd != NULL) BIO_free(bmd);
        apps_shutdown();
-       EXIT(err);
+       OPENSSL_EXIT(err);
        }
 
 int do_fp(BIO *out, unsigned char *buf, BIO *bp, int sep, int binout,
index 27c3dc8df22cdc8e86d5d8a80ccaaace72bff20d..c10ea96b90ac9a4cd7c92b00cf7fdfac44a532b1 100644 (file)
--- a/apps/dh.c
+++ b/apps/dh.c
@@ -333,6 +333,6 @@ end:
        if (out != NULL) BIO_free_all(out);
        if (dh != NULL) DH_free(dh);
        apps_shutdown();
-       EXIT(ret);
+       OPENSSL_EXIT(ret);
        }
 #endif
index ea15ef32368f66abcf45b6575727f47d9d9c83c5..cbc65bcc5f5e94c4686efb979e741e07a48861b6 100644 (file)
@@ -519,7 +519,7 @@ end:
        if (out != NULL) BIO_free_all(out);
        if (dh != NULL) DH_free(dh);
        apps_shutdown();
-       EXIT(ret);
+       OPENSSL_EXIT(ret);
        }
 
 /* dh_cb is identical to dsa_cb in apps/dsaparam.c */
index 9da1a41645b78f493d78d24bb5c23410c9959617..65988717bbd176270c0652f84a427220919922fa 100644 (file)
@@ -314,6 +314,6 @@ end:
        if(passin) OPENSSL_free(passin);
        if(passout) OPENSSL_free(passout);
        apps_shutdown();
-       EXIT(ret);
+       OPENSSL_EXIT(ret);
        }
 #endif
index 2f436803e36ce598d417f16303626b361fc021a5..320d76f632d43dea28207672f0dc28b333e9dd3b 100644 (file)
@@ -372,7 +372,7 @@ end:
        if (out != NULL) BIO_free_all(out);
        if (dsa != NULL) DSA_free(dsa);
        apps_shutdown();
-       EXIT(ret);
+       OPENSSL_EXIT(ret);
        }
 
 static void MS_CALLBACK dsa_cb(int p, int n, void *arg)
index bae7f21d79047530792c9ded85f31c9e845f2d30..42ddfd244bc5588c5983edefa2881a1b78e0fd50 100644 (file)
@@ -586,7 +586,7 @@ end:
        if (b64 != NULL) BIO_free(b64);
        if(pass) OPENSSL_free(pass);
        apps_shutdown();
-       EXIT(ret);
+       OPENSSL_EXIT(ret);
        }
 
 int set_hex(char *in, unsigned char *out, int size)
index 734ecb3e5db0a4581bc5e495d7057f8785536041..b718ae124c05f6523178fc29cbd62e84b7e8993f 100644 (file)
@@ -516,5 +516,5 @@ end:
        sk_pop_free(post_cmds, identity);
        if (bio_out != NULL) BIO_free_all(bio_out);
        apps_shutdown();
-       EXIT(ret);
+       OPENSSL_EXIT(ret);
        }
index fedb568d686988ce9da114c63495227f2b927bfe..19489b0df3b7b9d7a83c924e77fc2107bce84e1e 100644 (file)
@@ -122,5 +122,5 @@ int MAIN(int argc, char **argv)
                        }
                }
        apps_shutdown();
-       EXIT(ret);
+       OPENSSL_EXIT(ret);
        }
index f2542960bf28be2bb311a750fba474bd2490eb7d..98ee413c74b716c82bf2f0f0ad2ea404cd2bb031 100644 (file)
@@ -198,7 +198,7 @@ end:
        if (out != NULL) BIO_free_all(out);
        if (dh != NULL) DH_free(dh);
        apps_shutdown();
-       EXIT(ret);
+       OPENSSL_EXIT(ret);
        }
 
 static void MS_CALLBACK dh_cb(int p, int n, void *arg)
index 1e1e9f3e4c4e672b439873ebc91db05613d12cef..4600711c369a138586dc50f1ff4bcf43bf9f2dab 100644 (file)
@@ -246,6 +246,6 @@ end:
        if (dsa != NULL) DSA_free(dsa);
        if(passout) OPENSSL_free(passout);
        apps_shutdown();
-       EXIT(ret);
+       OPENSSL_EXIT(ret);
        }
 #endif
index 515bd7c9017135667781a2c8cc4ba3ae2ba84d16..dbc23e40aa85f46afd009cc5d8a262c8b8b5aaa7 100644 (file)
@@ -258,7 +258,7 @@ err:
        if (ret != 0)
                ERR_print_errors(bio_err);
        apps_shutdown();
-       EXIT(ret);
+       OPENSSL_EXIT(ret);
        }
 
 static void MS_CALLBACK genrsa_cb(int p, int n, void *arg)
index c26f62cb6137d07c2a26d8b7dd56c3f559d6caeb..dc71d45012f8002e01e533410515aacf40cb5046 100644 (file)
@@ -102,7 +102,7 @@ int MAIN(int argc, char **argv)
                BIO_printf (bio_err, "-in file  input file\n");
                BIO_printf (bio_err, "-out file output file\n");
                BIO_printf (bio_err, "-toseq    output NS Sequence file\n");
-               EXIT(1);
+               OPENSSL_EXIT(1);
        }
 
        if (infile) {
@@ -162,6 +162,6 @@ end:
        BIO_free_all(out);
        NETSCAPE_CERT_SEQUENCE_free(seq);
 
-       EXIT(ret);
+       OPENSSL_EXIT(ret);
 }
 
index d759b2709ca2b0549e08059801f6d31a862d05bd..92922bc8ad6f0568bac17dd4eb969cef316407b7 100644 (file)
@@ -899,7 +899,7 @@ end:
                SSL_CTX_free(ctx);
                }
 
-       EXIT(ret);
+       OPENSSL_EXIT(ret);
 }
 
 static int add_ocsp_cert(OCSP_REQUEST **req, X509 *cert, X509 *issuer,
index 45f8d7f4ef2b1faca9294d7ad51afc24f4768b2b..47896472e8fd19bb751c9400c84e2a51b01a8689 100644 (file)
@@ -358,7 +358,7 @@ end:
                BIO_free(bio_err);
                bio_err=NULL;
                }
-       EXIT(ret);
+       OPENSSL_EXIT(ret);
        }
 
 #define LIST_STANDARD_COMMANDS "list-standard-commands"
index 0c2cf62e8bec2e93f767fa4f99c3a1c848978fd3..3ad91d89d6a51f3647d3212e294fdc2b809e35b4 100644 (file)
@@ -292,7 +292,7 @@ err:
        if (out)
                BIO_free_all(out);
        apps_shutdown();
-       EXIT(ret);
+       OPENSSL_EXIT(ret);
        }
 
 
@@ -505,6 +505,6 @@ err:
 int MAIN(int argc, char **argv)
        {
        fputs("Program not available.\n", stderr)
-       EXIT(1);
+       OPENSSL_EXIT(1);
        }
 #endif
index bb11e26723acfc1fe932cba61dc796c45c5fc1c4..8d1babe5eab76e16d1a1c2edf3f4a256a259c64c 100644 (file)
@@ -696,7 +696,7 @@ int MAIN(int argc, char **argv)
     if(passin) OPENSSL_free(passin);
     if(passout) OPENSSL_free(passout);
     apps_shutdown();
-    EXIT(ret);
+    OPENSSL_EXIT(ret);
 }
 
 int dump_certs_keys_p12 (BIO *out, PKCS12 *p12, char *pass,
index 0cced40f0f10a8ea8bb1b527a57bd18ca6c46c8a..738dd853ceed006ba3e28fe4eaea8599a2b704a7 100644 (file)
@@ -301,5 +301,5 @@ end:
        if (in != NULL) BIO_free(in);
        if (out != NULL) BIO_free_all(out);
        apps_shutdown();
-       EXIT(ret);
+       OPENSSL_EXIT(ret);
        }
index f51f5bec3560d487c38d6e6fc45b2d51b56accda..eaaa6e35a62008572fb2da51ac294506595e6868 100644 (file)
@@ -213,5 +213,5 @@ err:
        if (out)
                BIO_free_all(out);
        apps_shutdown();
-       EXIT(ret);
+       OPENSSL_EXIT(ret);
        }
index c2bada07c8f649c2ad33b899a82b278d121bb459..d8f3611ace538b67f18541704c70bd6ea4909d90 100644 (file)
@@ -1075,7 +1075,7 @@ end:
        if (dsa_params != NULL) DSA_free(dsa_params);
 #endif
        apps_shutdown();
-       EXIT(ex);
+       OPENSSL_EXIT(ex);
        }
 
 static int make_REQ(X509_REQ *req, EVP_PKEY *pkey, char *subj, int attribs,
index 4e19bc16fb877d019abe2aa65e38be1ed2c90cbb..aebec744a2929ffabc36de6dbdd2144e634157cb 100644 (file)
@@ -369,7 +369,7 @@ end:
        if(passin) OPENSSL_free(passin);
        if(passout) OPENSSL_free(passout);
        apps_shutdown();
-       EXIT(ret);
+       OPENSSL_EXIT(ret);
        }
 #else /* !OPENSSL_NO_RSA */
 
index 7b1fa7b22be01569f6636766b3f699a70ab5706b..738588c6aab65163d3c7bd7f909213e73280853e 100644 (file)
@@ -917,7 +917,7 @@ end:
                bio_c_out=NULL;
                }
        apps_shutdown();
-       EXIT(ret);
+       OPENSSL_EXIT(ret);
        }
 
 
index 94dd59becc3a48d2196e90420dd35ef00cba28e1..44886c5c26150e48a8862dab24781669fdc837a2 100644 (file)
@@ -868,7 +868,7 @@ end:
                bio_s_out=NULL;
                }
        apps_shutdown();
-       EXIT(ret);
+       OPENSSL_EXIT(ret);
        }
 
 static void print_stats(BIO *bio, SSL_CTX *ssl_ctx)
index 181a7c82f66e80555824575e19084b3177b77536..1ad16cd607d4f95979b40a4e8f4aecc040d1a18a 100644 (file)
@@ -642,7 +642,7 @@ end:
                tm_ctx=NULL;
                }
        apps_shutdown();
-       EXIT(ret);
+       OPENSSL_EXIT(ret);
        }
 
 /***********************************************************************
index 41c3b3f4a3ab649ba05ae3580b8ecbdc7bc292d3..d91d84d2206b08b570908d694bc082a90f58dc3c 100644 (file)
@@ -273,7 +273,7 @@ end:
        if (out != NULL) BIO_free_all(out);
        if (x != NULL) SSL_SESSION_free(x);
        apps_shutdown();
-       EXIT(ret);
+       OPENSSL_EXIT(ret);
        }
 
 static SSL_SESSION *load_sess_id(char *infile, int format)
index b5e17a1f29935884451dc3a018c7d75cb425cb85..7f42b52e73fd1804975c2f7ba04ff1ecb7661f0a 100644 (file)
@@ -1729,7 +1729,7 @@ end:
                        DSA_free(dsa_key[i]);
 #endif
        apps_shutdown();
-       EXIT(mret);
+       OPENSSL_EXIT(mret);
        }
 
 static void print_message(const char *s, long num, int length)
index 4ce53e36c9022820432338aa525719efafe22bd0..ed370c5ca9c688168efad85956a11108cb9ccdca 100644 (file)
@@ -295,5 +295,5 @@ end:
        EVP_PKEY_free(pkey);
        if(passin) OPENSSL_free(passin);
        apps_shutdown();
-       EXIT(ret);
+       OPENSSL_EXIT(ret);
        }
index e4cbceaf8e8785cfa3d40921055b2e760816b372..9a18213ece454c45b93f03ee649424d4342eb63e 100644 (file)
@@ -232,7 +232,7 @@ end:
        sk_X509_pop_free(untrusted, X509_free);
        sk_X509_pop_free(trusted, X509_free);
        apps_shutdown();
-       EXIT(ret);
+       OPENSSL_EXIT(ret);
        }
 
 static int check(X509_STORE *ctx, char *file, STACK_OF(X509) *uchain, STACK_OF(X509) *tchain, int purpose, ENGINE *e)
index 0cbcb47f881f4a39700976b9486828f753534766..0843b67565e7ef795ae6c6d82c173e7bc5250636 100644 (file)
@@ -200,5 +200,5 @@ int MAIN(int argc, char **argv)
        if (dir)  printf("%s\n",SSLeay_version(SSLEAY_DIR));
 end:
        apps_shutdown();
-       EXIT(ret);
+       OPENSSL_EXIT(ret);
        }
index 8c057be214f2d4b2ce80aabdaf5c0c9916ce31df..7915eca65c828ec1382453a855a5c3d1d71023f2 100644 (file)
@@ -1017,7 +1017,7 @@ end:
        sk_ASN1_OBJECT_pop_free(reject, ASN1_OBJECT_free);
        if (passin) OPENSSL_free(passin);
        apps_shutdown();
-       EXIT(ret);
+       OPENSSL_EXIT(ret);
        }
 
 static ASN1_INTEGER *load_serial(char *CAfile, char *serialfile, int create)
diff --git a/e_os.h b/e_os.h
index 5d761781b8577ef4e4ed4bb23ac7a849ba8ba034..db9ba97ec8451d985a9b5267bc26ca745fedea12 100644 (file)
--- a/e_os.h
+++ b/e_os.h
@@ -243,10 +243,11 @@ extern "C" {
 #    define _kbhit kbhit
 #  endif
 
-#  if defined(WIN16) && !defined(MONOLITH) && defined(SSLEAY) && defined(_WINEXITNOPERSIST)
-#    define EXIT(n) do { if (n == 0) _wsetexit(_WINEXITNOPERSIST); return(n); } while(0)
+#  if defined(WIN16) && defined(SSLEAY) && defined(_WINEXITNOPERSIST)
+#    define EXIT(n) _wsetexit(_WINEXITNOPERSIST)
+#    define OPENSSL_EXIT(n) do { if (n == 0) EXIT(n); return(n); } while(0)
 #  else
-#    define EXIT(n)            return(n)
+#    define EXIT(n) return(n)
 #  endif
 #  define LIST_SEPARATOR_CHAR ';'
 #  ifndef X_OK
@@ -302,18 +303,13 @@ extern "C" {
      the status is tagged as an error, which I believe is what is wanted here.
      -- Richard Levitte
   */
-#    if !defined(MONOLITH) || defined(OPENSSL_C)
-#      define EXIT(n)          do { int __VMS_EXIT = n; \
+#    define EXIT(n)            do { int __VMS_EXIT = n; \
                                      if (__VMS_EXIT == 0) \
                                       __VMS_EXIT = 1; \
                                     else \
                                       __VMS_EXIT = (n << 3) | 2; \
                                      __VMS_EXIT |= 0x10000000; \
-                                    exit(__VMS_EXIT); \
-                                    return(__VMS_EXIT); } while(0)
-#    else
-#      define EXIT(n)          return(n)
-#    endif
+                                    exit(__VMS_EXIT); } while(0)
 #    define NO_SYS_PARAM_H
 #  else
      /* !defined VMS */
@@ -344,11 +340,7 @@ extern "C" {
 #    define RFILE              ".rnd"
 #    define LIST_SEPARATOR_CHAR ':'
 #    define NUL_DEV            "/dev/null"
-#    ifndef MONOLITH
-#      define EXIT(n)          do { exit(n); return(n); } while(0)
-#    else
-#      define EXIT(n)          return(n)
-#    endif
+#    define EXIT(n)            exit(n)
 #  endif
 
 #  define SSLeay_getpid()      getpid()
@@ -475,6 +467,14 @@ extern char *sys_errlist[]; extern int sys_nerr;
        (((errnum)<0 || (errnum)>=sys_nerr) ? NULL : sys_errlist[errnum])
 #endif
 
+#ifndef OPENSSL_EXIT
+# if defined(MONOLITH) && !defined(OPENSSL_C)
+#  define OPENSSL_EXIT(n) return(n)
+# else
+#  define OPENSSL_EXIT(n) do { EXIT(n); return(n); } while(0)
+# endif
+#endif
+
 /***********************************************/
 
 /* do we need to do this for getenv.