aboutsummaryrefslogtreecommitdiffstats
path: root/erts
diff options
context:
space:
mode:
authorRickard Green <[email protected]>2017-05-24 15:30:27 +0200
committerGitHub <[email protected]>2017-05-24 15:30:27 +0200
commit1371b953c7c2c37ea078248998f0be3d396297f5 (patch)
treef2a353e50dcc5a049c0ddac72839b3adbc5ca68c /erts
parent6062563734a9b71c9670860bff85f661f74eb7af (diff)
parent68de330d763fb450a763a2d56e63dbe009e12703 (diff)
downloadotp-1371b953c7c2c37ea078248998f0be3d396297f5.tar.gz
otp-1371b953c7c2c37ea078248998f0be3d396297f5.tar.bz2
otp-1371b953c7c2c37ea078248998f0be3d396297f5.zip
Merge pull request #1475 from rickard-green/rickard/escript-emulator-fix
Fix erlang system lookup from escript bug introduced in PR #1293 OTP-14201
Diffstat (limited to 'erts')
-rw-r--r--erts/etc/common/escript.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/erts/etc/common/escript.c b/erts/etc/common/escript.c
index 630e241882..80cc25b040 100644
--- a/erts/etc/common/escript.c
+++ b/erts/etc/common/escript.c
@@ -433,7 +433,7 @@ main(int argc, char** argv)
char* emulator;
char* env;
char* basename;
- char* absname;
+ char* def_emu_lookup_path;
char scriptname[PMAX];
char** last_opt;
char** first_opt;
@@ -480,6 +480,7 @@ main(int argc, char** argv)
#else
if (strcmp(basename, "escript") == 0) {
#endif
+ def_emu_lookup_path = argv[0];
/*
* Locate all options before the script name.
*/
@@ -498,27 +499,24 @@ main(int argc, char** argv)
argc--;
argv++;
} else {
+ char *absname = find_prog(argv[0]);
#ifdef __WIN32__
- int len;
-#endif
- absname = find_prog(argv[0]);
-#ifdef __WIN32__
- len = strlen(absname);
+ int len = strlen(absname);
if (len >= 4 && _stricmp(absname+len-4, ".exe") == 0) {
absname[len-4] = '\0';
}
#endif
-
erts_snprintf(scriptname, sizeof(scriptname), "%s.escript",
absname);
- efree(absname);
+ efree(absname);
+ def_emu_lookup_path = scriptname;
}
/* Determine path to emulator */
emulator = env = get_env("ESCRIPT_EMULATOR");
if (emulator == NULL) {
- emulator = get_default_emulator(scriptname);
+ emulator = get_default_emulator(def_emu_lookup_path);
}
if (strlen(emulator) >= PMAX)