diff options
author | Zefram <zefram@fysh.org> | 2017-12-21 05:40:49 +0000 |
---|---|---|
committer | Zefram <zefram@fysh.org> | 2017-12-21 05:47:52 +0000 |
commit | fe2024f944c63d1ef0759b7fcf1b4577462ba167 (patch) | |
tree | a159d3e90d9d06b020179ecc993b075a529cf977 /NetWare | |
parent | 946b6ed4ec08dfa012129f650bc1259f5ea1dd48 (diff) | |
download | perl-fe2024f944c63d1ef0759b7fcf1b4577462ba167.tar.gz |
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.
Diffstat (limited to 'NetWare')
-rw-r--r-- | NetWare/interface.c | 15 | ||||
-rw-r--r-- | NetWare/interface.cpp | 16 | ||||
-rw-r--r-- | NetWare/interface.h | 2 | ||||
-rw-r--r-- | NetWare/iperlhost.h | 2 |
4 files changed, 17 insertions, 18 deletions
diff --git a/NetWare/interface.c b/NetWare/interface.c index 29a8dc0d24..1d298854c9 100644 --- a/NetWare/interface.c +++ b/NetWare/interface.c @@ -78,10 +78,10 @@ ClsPerlHost::PerlRun(PerlInterpreter *my_perl) return(perl_run(my_perl)); // Run Perl. } -void +int ClsPerlHost::PerlDestroy(PerlInterpreter *my_perl) { - perl_destruct(my_perl); // Destructor for Perl. + return(perl_destruct(my_perl)); // Destructor for Perl. } void @@ -148,19 +148,18 @@ int RunPerl(int argc, char **argv, char **env) { PL_perl_destruct_level = 0; - exitstatus = nlm.PerlParse(my_perl, argc, argv, env); - if(exitstatus == 0) + if(!nlm.PerlParse(my_perl, argc, argv, env)) { #if defined(TOP_CLONE) && defined(USE_ITHREADS) // XXXXXX testing new_perl = perl_clone(my_perl, 1); - exitstatus = perl_run(new_perl); // Run Perl. + (void) perl_run(new_perl); // Run Perl. PERL_SET_THX(my_perl); #else - exitstatus = nlm.PerlRun(my_perl); + (void) nlm.PerlRun(my_perl); #endif } - nlm.PerlDestroy(my_perl); + exitstatus = nlm.PerlDestroy(my_perl); } if(my_perl) nlm.PerlFree(my_perl); @@ -169,7 +168,7 @@ int RunPerl(int argc, char **argv, char **env) if (new_perl) { PERL_SET_THX(new_perl); - nlm.PerlDestroy(new_perl); + exitstatus = nlm.PerlDestroy(new_perl); nlm.PerlFree(my_perl); } #endif diff --git a/NetWare/interface.cpp b/NetWare/interface.cpp index aef71f9ffa..b08d6c249e 100644 --- a/NetWare/interface.cpp +++ b/NetWare/interface.cpp @@ -69,11 +69,12 @@ ClsPerlHost::PerlRun(PerlInterpreter *my_perl) return(perl_run(my_perl)); // Run Perl. } -void +int ClsPerlHost::PerlDestroy(PerlInterpreter *my_perl) { - perl_destruct(my_perl); // Destructor for Perl. + int ret = perl_destruct(my_perl); // Destructor for Perl. //// perl_free(my_perl); // Free the memory allocated for Perl. + return(ret); } void @@ -142,8 +143,7 @@ int RunPerl(int argc, char **argv, char **env) { PL_perl_destruct_level = 0; - exitstatus = nlm.PerlParse(my_perl, argc, argv, env); - if(exitstatus == 0) + if(!nlm.PerlParse(my_perl, argc, argv, env)) { #if defined(TOP_CLONE) && defined(USE_ITHREADS) // XXXXXX testing # ifdef PERL_OBJECT @@ -164,13 +164,13 @@ int RunPerl(int argc, char **argv, char **env) new_perl = perl_clone(my_perl, 1); # endif - exitstatus = perl_run(new_perl); // Run Perl. + (void) perl_run(new_perl); // Run Perl. PERL_SET_THX(my_perl); #else - exitstatus = nlm.PerlRun(my_perl); + (void) nlm.PerlRun(my_perl); #endif } - nlm.PerlDestroy(my_perl); + exitstatus = nlm.PerlDestroy(my_perl); } if(my_perl) nlm.PerlFree(my_perl); @@ -179,7 +179,7 @@ int RunPerl(int argc, char **argv, char **env) if (new_perl) { PERL_SET_THX(new_perl); - nlm.PerlDestroy(new_perl); + exitstatus = nlm.PerlDestroy(new_perl); nlm.PerlFree(my_perl); } #endif diff --git a/NetWare/interface.h b/NetWare/interface.h index 98979937e3..2c9d46d75d 100644 --- a/NetWare/interface.h +++ b/NetWare/interface.h @@ -35,7 +35,7 @@ public: int PerlCreate(PerlInterpreter *my_perl); int PerlParse(PerlInterpreter *my_perl, int argc, char** argv, char** env); int PerlRun(PerlInterpreter *my_perl); - void PerlDestroy(PerlInterpreter *my_perl); + int PerlDestroy(PerlInterpreter *my_perl); void PerlFree(PerlInterpreter *my_perl); //bool RegisterWithThreadTable(void); diff --git a/NetWare/iperlhost.h b/NetWare/iperlhost.h index cc1754afb3..fe3dab7a34 100644 --- a/NetWare/iperlhost.h +++ b/NetWare/iperlhost.h @@ -33,7 +33,7 @@ public: virtual int PerlCreate(PerlInterpreter *my_perl) = 0; virtual int PerlParse(PerlInterpreter *my_perl,int argc, char** argv, char** env) = 0; virtual int PerlRun(PerlInterpreter *my_perl) = 0; - virtual void PerlDestroy(PerlInterpreter *my_perl) = 0; + virtual int PerlDestroy(PerlInterpreter *my_perl) = 0; virtual void PerlFree(PerlInterpreter *my_perl) = 0; //virtual bool RegisterWithThreadTable(void)=0; |