From fe2024f944c63d1ef0759b7fcf1b4577462ba167 Mon Sep 17 00:00:00 2001 From: Zefram Date: Thu, 21 Dec 2017 05:40:49 +0000 Subject: fix up faulty perl embeddings Some platform-specific embeddings of perl were misusing the return values from perl_parse() and perl_run(), in some cases causing failure due to exit(0) combined with the recent changes in commit 0301e899536a22752f40481d8a1d141b7a7dda82. Commit d4a50999a5525c2681d59cae5fcd94f94ff897fd partially fixed a Windows embedding. More fully fix that, along with NetWare and OS/2. Even in embeddings with correct logic, stop using a variable named "exitstatus" to hold the result of perl_parse() or perl_run(), to avoid misleading people who copy the code. --- os2/perlrexx.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'os2') diff --git a/os2/perlrexx.c b/os2/perlrexx.c index 98a550262a..18d655137d 100644 --- a/os2/perlrexx.c +++ b/os2/perlrexx.c @@ -61,7 +61,6 @@ init_perlos2(void) static int init_perl(int doparse) { - int exitstatus; char *argv[3] = {"perl_in_REXX", "-e", ""}; if (!perlos2_is_inited) { @@ -79,8 +78,7 @@ init_perl(int doparse) } if (!doparse) return 1; - exitstatus = perl_parse(my_perl, xs_init, 3, argv, (char **)NULL); - return !exitstatus; + return !perl_parse(my_perl, xs_init, 3, argv, (char **)NULL); } static char last_error[4096]; @@ -125,12 +123,10 @@ ULONG PERL (PCSZ name, LONG rargc, const RXSTRING *rargv, memcpy(buf, rargv[0].strptr, rargv[0].strlength); buf[rargv[0].strlength] = 0; - exitstatus = perl_parse(my_perl, xs_init, 3, argv, (char **)NULL); - if (!exitstatus) { - exitstatus = perl_run(my_perl); - } + if (!perl_parse(my_perl, xs_init, 3, argv, (char **)NULL)) + perl_run(my_perl); - perl_destruct(my_perl); + exitstatus = perl_destruct(my_perl); perl_free(my_perl); my_perl = 0; -- cgit v1.2.1