diff options
author | Richard Levitte <levitte@openssl.org> | 2016-03-30 08:35:18 +0200 |
---|---|---|
committer | Richard Levitte <levitte@openssl.org> | 2016-03-30 20:25:08 +0200 |
commit | 087ca80ad83071dde0bb6bc1c28c743caa00eaf8 (patch) | |
tree | 63e6d61af33aeae5da33ca126e3582231295ddaf /apps/openssl.c | |
parent | 90dbd25097d7d4af0bea0cd9cab60d749ed0a6a2 (diff) | |
download | openssl-087ca80ad83071dde0bb6bc1c28c743caa00eaf8.tar.gz |
Fix pointer size issues with argv on VMS
The argument 'argv' in 'main' is a short pointer to a short pointer on
VMS, regardless of initial pointer size. We must therefore make sure
that 'copy_argv' gets a 32-bit pointer for argv, and that the copied
argv is used for the rest of main().
This introduces the local type argv_t, which will have correct pointer
size in all cases (and be harmless on all other platforms) as well as
the macro Argv, which is defined as 'copied_argv' or 'argv', as the
case may be.
Reviewed-by: Andy Polyakov <appro@openssl.org>
Diffstat (limited to 'apps/openssl.c')
-rw-r--r-- | apps/openssl.c | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/apps/openssl.c b/apps/openssl.c index 2d9ddaa56b..166c7a1e45 100644 --- a/apps/openssl.c +++ b/apps/openssl.c @@ -207,15 +207,12 @@ static char *make_config_name() return p; } -#if defined( OPENSSL_SYS_VMS) -extern char **copy_argv(int *argc, char **argv); -#endif - int main(int argc, char *argv[]) { FUNCTION f, *fp; LHASH_OF(FUNCTION) *prog = NULL; char **copied_argv = NULL; + char **argv_alias = NULL; char *p, *pname; char buf[1024]; const char *prompt; @@ -231,8 +228,10 @@ int main(int argc, char *argv[]) bio_out = dup_bio_out(FORMAT_TEXT); bio_err = dup_bio_err(FORMAT_TEXT); -#if defined( OPENSSL_SYS_VMS) - copied_argv = argv = copy_argv(&argc, argv); +#if defined( OPENSSL_SYS_VMS) && defined(__DECC) + copied_argv = argv_alias = copy_argv(&argc, argv); +#else + argv_alias = argv; #endif p = getenv("OPENSSL_DEBUG_MEMORY"); @@ -256,22 +255,22 @@ int main(int argc, char *argv[]) goto end; prog = prog_init(); - pname = opt_progname(argv[0]); + pname = opt_progname(argv_alias[0]); /* first check the program name */ f.name = pname; fp = lh_FUNCTION_retrieve(prog, &f); if (fp != NULL) { - argv[0] = pname; - ret = fp->func(argc, argv); + argv_alias[0] = pname; + ret = fp->func(argc, argv_alias); goto end; } /* If there is stuff on the command line, run with that. */ if (argc != 1) { argc--; - argv++; - ret = do_cmd(prog, argc, argv); + argv_alias++; + ret = do_cmd(prog, argc, argv_alias); if (ret < 0) ret = 0; goto end; |