summaryrefslogtreecommitdiff
path: root/win32/perllib.c
diff options
context:
space:
mode:
authorZefram <zefram@fysh.org>2017-12-21 05:40:49 +0000
committerZefram <zefram@fysh.org>2017-12-21 05:47:52 +0000
commitfe2024f944c63d1ef0759b7fcf1b4577462ba167 (patch)
treea159d3e90d9d06b020179ecc993b075a529cf977 /win32/perllib.c
parent946b6ed4ec08dfa012129f650bc1259f5ea1dd48 (diff)
downloadperl-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 'win32/perllib.c')
-rw-r--r--win32/perllib.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/win32/perllib.c b/win32/perllib.c
index 8a6626fc5e..246f67aa1a 100644
--- a/win32/perllib.c
+++ b/win32/perllib.c
@@ -242,14 +242,13 @@ RunPerl(int argc, char **argv, char **env)
if (use_environ)
env = environ;
- exitstatus = perl_parse(my_perl, xs_init, argc, argv, env);
- if (!exitstatus) {
+ if (!perl_parse(my_perl, xs_init, argc, argv, env)) {
#if defined(TOP_CLONE) && defined(USE_ITHREADS) /* XXXXXX testing */
new_perl = perl_clone(my_perl, 1);
- exitstatus = perl_run(new_perl);
+ (void) perl_run(new_perl);
PERL_SET_THX(my_perl);
#else
- exitstatus = perl_run(my_perl);
+ (void) perl_run(my_perl);
#endif
}
@@ -258,7 +257,7 @@ RunPerl(int argc, char **argv, char **env)
#ifdef USE_ITHREADS
if (new_perl) {
PERL_SET_THX(new_perl);
- perl_destruct(new_perl);
+ exitstatus = perl_destruct(new_perl);
perl_free(new_perl);
}
#endif