EXIT() may mean return(). That's confusing, so let's have it really mean

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)
This commit is contained in:
Richard Levitte 2002-12-03 16:34:28 +00:00
parent 49cd4b7316
commit 27498a3330
35 changed files with 51 additions and 51 deletions

View File

@ -332,6 +332,6 @@ end:
if (osk != NULL) sk_free(osk); if (osk != NULL) sk_free(osk);
OBJ_cleanup(); OBJ_cleanup();
apps_shutdown(); apps_shutdown();
EXIT(ret); OPENSSL_EXIT(ret);
} }

View File

@ -1647,7 +1647,7 @@ err:
NCONF_free(conf); NCONF_free(conf);
OBJ_cleanup(); OBJ_cleanup();
apps_shutdown(); apps_shutdown();
EXIT(ret); OPENSSL_EXIT(ret);
} }
static void lookup_fail(char *name, char *tag) static void lookup_fail(char *name, char *tag)

View File

@ -203,6 +203,6 @@ end:
if (ssl != NULL) SSL_free(ssl); if (ssl != NULL) SSL_free(ssl);
if (STDout != NULL) BIO_free_all(STDout); if (STDout != NULL) BIO_free_all(STDout);
apps_shutdown(); apps_shutdown();
EXIT(ret); OPENSSL_EXIT(ret);
} }

View File

@ -377,7 +377,7 @@ end:
X509_STORE_free(store); X509_STORE_free(store);
} }
apps_shutdown(); apps_shutdown();
EXIT(ret); OPENSSL_EXIT(ret);
} }
static X509_CRL *load_crl(char *infile, int format) static X509_CRL *load_crl(char *infile, int format)

View File

@ -280,7 +280,7 @@ end:
if (crl != NULL) X509_CRL_free(crl); if (crl != NULL) X509_CRL_free(crl);
apps_shutdown(); apps_shutdown();
EXIT(ret); OPENSSL_EXIT(ret);
} }
/* /*

View File

@ -365,7 +365,7 @@ end:
if(sigbuf) OPENSSL_free(sigbuf); if(sigbuf) OPENSSL_free(sigbuf);
if (bmd != NULL) BIO_free(bmd); if (bmd != NULL) BIO_free(bmd);
apps_shutdown(); apps_shutdown();
EXIT(err); OPENSSL_EXIT(err);
} }
int do_fp(BIO *out, unsigned char *buf, BIO *bp, int sep, int binout, int do_fp(BIO *out, unsigned char *buf, BIO *bp, int sep, int binout,

View File

@ -333,6 +333,6 @@ end:
if (out != NULL) BIO_free_all(out); if (out != NULL) BIO_free_all(out);
if (dh != NULL) DH_free(dh); if (dh != NULL) DH_free(dh);
apps_shutdown(); apps_shutdown();
EXIT(ret); OPENSSL_EXIT(ret);
} }
#endif #endif

View File

@ -519,7 +519,7 @@ end:
if (out != NULL) BIO_free_all(out); if (out != NULL) BIO_free_all(out);
if (dh != NULL) DH_free(dh); if (dh != NULL) DH_free(dh);
apps_shutdown(); apps_shutdown();
EXIT(ret); OPENSSL_EXIT(ret);
} }
/* dh_cb is identical to dsa_cb in apps/dsaparam.c */ /* dh_cb is identical to dsa_cb in apps/dsaparam.c */

View File

@ -314,6 +314,6 @@ end:
if(passin) OPENSSL_free(passin); if(passin) OPENSSL_free(passin);
if(passout) OPENSSL_free(passout); if(passout) OPENSSL_free(passout);
apps_shutdown(); apps_shutdown();
EXIT(ret); OPENSSL_EXIT(ret);
} }
#endif #endif

View File

@ -372,7 +372,7 @@ end:
if (out != NULL) BIO_free_all(out); if (out != NULL) BIO_free_all(out);
if (dsa != NULL) DSA_free(dsa); if (dsa != NULL) DSA_free(dsa);
apps_shutdown(); apps_shutdown();
EXIT(ret); OPENSSL_EXIT(ret);
} }
static void MS_CALLBACK dsa_cb(int p, int n, void *arg) static void MS_CALLBACK dsa_cb(int p, int n, void *arg)

View File

@ -586,7 +586,7 @@ end:
if (b64 != NULL) BIO_free(b64); if (b64 != NULL) BIO_free(b64);
if(pass) OPENSSL_free(pass); if(pass) OPENSSL_free(pass);
apps_shutdown(); apps_shutdown();
EXIT(ret); OPENSSL_EXIT(ret);
} }
int set_hex(char *in, unsigned char *out, int size) int set_hex(char *in, unsigned char *out, int size)

View File

@ -516,5 +516,5 @@ end:
sk_pop_free(post_cmds, identity); sk_pop_free(post_cmds, identity);
if (bio_out != NULL) BIO_free_all(bio_out); if (bio_out != NULL) BIO_free_all(bio_out);
apps_shutdown(); apps_shutdown();
EXIT(ret); OPENSSL_EXIT(ret);
} }

View File

@ -122,5 +122,5 @@ int MAIN(int argc, char **argv)
} }
} }
apps_shutdown(); apps_shutdown();
EXIT(ret); OPENSSL_EXIT(ret);
} }

View File

@ -198,7 +198,7 @@ end:
if (out != NULL) BIO_free_all(out); if (out != NULL) BIO_free_all(out);
if (dh != NULL) DH_free(dh); if (dh != NULL) DH_free(dh);
apps_shutdown(); apps_shutdown();
EXIT(ret); OPENSSL_EXIT(ret);
} }
static void MS_CALLBACK dh_cb(int p, int n, void *arg) static void MS_CALLBACK dh_cb(int p, int n, void *arg)

View File

@ -246,6 +246,6 @@ end:
if (dsa != NULL) DSA_free(dsa); if (dsa != NULL) DSA_free(dsa);
if(passout) OPENSSL_free(passout); if(passout) OPENSSL_free(passout);
apps_shutdown(); apps_shutdown();
EXIT(ret); OPENSSL_EXIT(ret);
} }
#endif #endif

View File

@ -258,7 +258,7 @@ err:
if (ret != 0) if (ret != 0)
ERR_print_errors(bio_err); ERR_print_errors(bio_err);
apps_shutdown(); apps_shutdown();
EXIT(ret); OPENSSL_EXIT(ret);
} }
static void MS_CALLBACK genrsa_cb(int p, int n, void *arg) static void MS_CALLBACK genrsa_cb(int p, int n, void *arg)

View File

@ -102,7 +102,7 @@ int MAIN(int argc, char **argv)
BIO_printf (bio_err, "-in file input file\n"); BIO_printf (bio_err, "-in file input file\n");
BIO_printf (bio_err, "-out file output file\n"); BIO_printf (bio_err, "-out file output file\n");
BIO_printf (bio_err, "-toseq output NS Sequence file\n"); BIO_printf (bio_err, "-toseq output NS Sequence file\n");
EXIT(1); OPENSSL_EXIT(1);
} }
if (infile) { if (infile) {
@ -162,6 +162,6 @@ end:
BIO_free_all(out); BIO_free_all(out);
NETSCAPE_CERT_SEQUENCE_free(seq); NETSCAPE_CERT_SEQUENCE_free(seq);
EXIT(ret); OPENSSL_EXIT(ret);
} }

View File

@ -899,7 +899,7 @@ end:
SSL_CTX_free(ctx); SSL_CTX_free(ctx);
} }
EXIT(ret); OPENSSL_EXIT(ret);
} }
static int add_ocsp_cert(OCSP_REQUEST **req, X509 *cert, X509 *issuer, static int add_ocsp_cert(OCSP_REQUEST **req, X509 *cert, X509 *issuer,

View File

@ -358,7 +358,7 @@ end:
BIO_free(bio_err); BIO_free(bio_err);
bio_err=NULL; bio_err=NULL;
} }
EXIT(ret); OPENSSL_EXIT(ret);
} }
#define LIST_STANDARD_COMMANDS "list-standard-commands" #define LIST_STANDARD_COMMANDS "list-standard-commands"

View File

@ -292,7 +292,7 @@ err:
if (out) if (out)
BIO_free_all(out); BIO_free_all(out);
apps_shutdown(); apps_shutdown();
EXIT(ret); OPENSSL_EXIT(ret);
} }
@ -505,6 +505,6 @@ err:
int MAIN(int argc, char **argv) int MAIN(int argc, char **argv)
{ {
fputs("Program not available.\n", stderr) fputs("Program not available.\n", stderr)
EXIT(1); OPENSSL_EXIT(1);
} }
#endif #endif

View File

@ -696,7 +696,7 @@ int MAIN(int argc, char **argv)
if(passin) OPENSSL_free(passin); if(passin) OPENSSL_free(passin);
if(passout) OPENSSL_free(passout); if(passout) OPENSSL_free(passout);
apps_shutdown(); apps_shutdown();
EXIT(ret); OPENSSL_EXIT(ret);
} }
int dump_certs_keys_p12 (BIO *out, PKCS12 *p12, char *pass, int dump_certs_keys_p12 (BIO *out, PKCS12 *p12, char *pass,

View File

@ -301,5 +301,5 @@ end:
if (in != NULL) BIO_free(in); if (in != NULL) BIO_free(in);
if (out != NULL) BIO_free_all(out); if (out != NULL) BIO_free_all(out);
apps_shutdown(); apps_shutdown();
EXIT(ret); OPENSSL_EXIT(ret);
} }

View File

@ -213,5 +213,5 @@ err:
if (out) if (out)
BIO_free_all(out); BIO_free_all(out);
apps_shutdown(); apps_shutdown();
EXIT(ret); OPENSSL_EXIT(ret);
} }

View File

@ -1075,7 +1075,7 @@ end:
if (dsa_params != NULL) DSA_free(dsa_params); if (dsa_params != NULL) DSA_free(dsa_params);
#endif #endif
apps_shutdown(); apps_shutdown();
EXIT(ex); OPENSSL_EXIT(ex);
} }
static int make_REQ(X509_REQ *req, EVP_PKEY *pkey, char *subj, int attribs, static int make_REQ(X509_REQ *req, EVP_PKEY *pkey, char *subj, int attribs,

View File

@ -369,7 +369,7 @@ end:
if(passin) OPENSSL_free(passin); if(passin) OPENSSL_free(passin);
if(passout) OPENSSL_free(passout); if(passout) OPENSSL_free(passout);
apps_shutdown(); apps_shutdown();
EXIT(ret); OPENSSL_EXIT(ret);
} }
#else /* !OPENSSL_NO_RSA */ #else /* !OPENSSL_NO_RSA */

View File

@ -917,7 +917,7 @@ end:
bio_c_out=NULL; bio_c_out=NULL;
} }
apps_shutdown(); apps_shutdown();
EXIT(ret); OPENSSL_EXIT(ret);
} }

View File

@ -868,7 +868,7 @@ end:
bio_s_out=NULL; bio_s_out=NULL;
} }
apps_shutdown(); apps_shutdown();
EXIT(ret); OPENSSL_EXIT(ret);
} }
static void print_stats(BIO *bio, SSL_CTX *ssl_ctx) static void print_stats(BIO *bio, SSL_CTX *ssl_ctx)

View File

@ -642,7 +642,7 @@ end:
tm_ctx=NULL; tm_ctx=NULL;
} }
apps_shutdown(); apps_shutdown();
EXIT(ret); OPENSSL_EXIT(ret);
} }
/*********************************************************************** /***********************************************************************

View File

@ -273,7 +273,7 @@ end:
if (out != NULL) BIO_free_all(out); if (out != NULL) BIO_free_all(out);
if (x != NULL) SSL_SESSION_free(x); if (x != NULL) SSL_SESSION_free(x);
apps_shutdown(); apps_shutdown();
EXIT(ret); OPENSSL_EXIT(ret);
} }
static SSL_SESSION *load_sess_id(char *infile, int format) static SSL_SESSION *load_sess_id(char *infile, int format)

View File

@ -1729,7 +1729,7 @@ end:
DSA_free(dsa_key[i]); DSA_free(dsa_key[i]);
#endif #endif
apps_shutdown(); apps_shutdown();
EXIT(mret); OPENSSL_EXIT(mret);
} }
static void print_message(const char *s, long num, int length) static void print_message(const char *s, long num, int length)

View File

@ -295,5 +295,5 @@ end:
EVP_PKEY_free(pkey); EVP_PKEY_free(pkey);
if(passin) OPENSSL_free(passin); if(passin) OPENSSL_free(passin);
apps_shutdown(); apps_shutdown();
EXIT(ret); OPENSSL_EXIT(ret);
} }

View File

@ -232,7 +232,7 @@ end:
sk_X509_pop_free(untrusted, X509_free); sk_X509_pop_free(untrusted, X509_free);
sk_X509_pop_free(trusted, X509_free); sk_X509_pop_free(trusted, X509_free);
apps_shutdown(); 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) static int check(X509_STORE *ctx, char *file, STACK_OF(X509) *uchain, STACK_OF(X509) *tchain, int purpose, ENGINE *e)

View File

@ -200,5 +200,5 @@ int MAIN(int argc, char **argv)
if (dir) printf("%s\n",SSLeay_version(SSLEAY_DIR)); if (dir) printf("%s\n",SSLeay_version(SSLEAY_DIR));
end: end:
apps_shutdown(); apps_shutdown();
EXIT(ret); OPENSSL_EXIT(ret);
} }

View File

@ -1017,7 +1017,7 @@ end:
sk_ASN1_OBJECT_pop_free(reject, ASN1_OBJECT_free); sk_ASN1_OBJECT_pop_free(reject, ASN1_OBJECT_free);
if (passin) OPENSSL_free(passin); if (passin) OPENSSL_free(passin);
apps_shutdown(); apps_shutdown();
EXIT(ret); OPENSSL_EXIT(ret);
} }
static ASN1_INTEGER *load_serial(char *CAfile, char *serialfile, int create) static ASN1_INTEGER *load_serial(char *CAfile, char *serialfile, int create)

26
e_os.h
View File

@ -243,8 +243,9 @@ extern "C" {
# define _kbhit kbhit # define _kbhit kbhit
# endif # endif
# if defined(WIN16) && !defined(MONOLITH) && defined(SSLEAY) && defined(_WINEXITNOPERSIST) # if defined(WIN16) && defined(SSLEAY) && defined(_WINEXITNOPERSIST)
# define EXIT(n) do { if (n == 0) _wsetexit(_WINEXITNOPERSIST); return(n); } while(0) # define EXIT(n) _wsetexit(_WINEXITNOPERSIST)
# define OPENSSL_EXIT(n) do { if (n == 0) EXIT(n); return(n); } while(0)
# else # else
# define EXIT(n) return(n) # define EXIT(n) return(n)
# endif # endif
@ -302,18 +303,13 @@ extern "C" {
the status is tagged as an error, which I believe is what is wanted here. the status is tagged as an error, which I believe is what is wanted here.
-- Richard Levitte -- 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) \ if (__VMS_EXIT == 0) \
__VMS_EXIT = 1; \ __VMS_EXIT = 1; \
else \ else \
__VMS_EXIT = (n << 3) | 2; \ __VMS_EXIT = (n << 3) | 2; \
__VMS_EXIT |= 0x10000000; \ __VMS_EXIT |= 0x10000000; \
exit(__VMS_EXIT); \ exit(__VMS_EXIT); } while(0)
return(__VMS_EXIT); } while(0)
# else
# define EXIT(n) return(n)
# endif
# define NO_SYS_PARAM_H # define NO_SYS_PARAM_H
# else # else
/* !defined VMS */ /* !defined VMS */
@ -344,11 +340,7 @@ extern "C" {
# define RFILE ".rnd" # define RFILE ".rnd"
# define LIST_SEPARATOR_CHAR ':' # define LIST_SEPARATOR_CHAR ':'
# define NUL_DEV "/dev/null" # define NUL_DEV "/dev/null"
# ifndef MONOLITH # define EXIT(n) exit(n)
# define EXIT(n) do { exit(n); return(n); } while(0)
# else
# define EXIT(n) return(n)
# endif
# endif # endif
# define SSLeay_getpid() getpid() # 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]) (((errnum)<0 || (errnum)>=sys_nerr) ? NULL : sys_errlist[errnum])
#endif #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. /* do we need to do this for getenv.