diff options
author | Mike Pall <mike> | 2013-05-25 10:18:12 +0200 |
---|---|---|
committer | Mike Pall <mike> | 2013-05-25 10:18:12 +0200 |
commit | 5a261dd92c72d8f9d2aab0714ce9e051f0d70219 (patch) | |
tree | ee36a876cb6ef4229a426efa9083811037371507 /src/luajit.c | |
parent | d686217926b75e6f93044b190943ad098d103bfe (diff) | |
download | luajit-5a261dd92c72d8f9d2aab0714ce9e051f0d70219.tar.gz luajit-5a261dd92c72d8f9d2aab0714ce9e051f0d70219.tar.bz2 luajit-5a261dd92c72d8f9d2aab0714ce9e051f0d70219.zip |
Fix compatibility issues with Illumos.
Thanks to Theo Schlossnagle.
Diffstat (limited to 'src/luajit.c')
-rw-r--r-- | src/luajit.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/src/luajit.c b/src/luajit.c index 37b0deb3..e0eacc42 100644 --- a/src/luajit.c +++ b/src/luajit.c | |||
@@ -499,15 +499,15 @@ static int handle_luainit(lua_State *L) | |||
499 | return dostring(L, init, "=" LUA_INIT); | 499 | return dostring(L, init, "=" LUA_INIT); |
500 | } | 500 | } |
501 | 501 | ||
502 | struct Smain { | 502 | static struct Smain { |
503 | char **argv; | 503 | char **argv; |
504 | int argc; | 504 | int argc; |
505 | int status; | 505 | int status; |
506 | }; | 506 | } smain; |
507 | 507 | ||
508 | static int pmain(lua_State *L) | 508 | static int pmain(lua_State *L) |
509 | { | 509 | { |
510 | struct Smain *s = (struct Smain *)lua_touserdata(L, 1); | 510 | struct Smain *s = &smain; |
511 | char **argv = s->argv; | 511 | char **argv = s->argv; |
512 | int script; | 512 | int script; |
513 | int flags = 0; | 513 | int flags = 0; |
@@ -556,17 +556,16 @@ static int pmain(lua_State *L) | |||
556 | int main(int argc, char **argv) | 556 | int main(int argc, char **argv) |
557 | { | 557 | { |
558 | int status; | 558 | int status; |
559 | struct Smain s; | ||
560 | lua_State *L = lua_open(); /* create state */ | 559 | lua_State *L = lua_open(); /* create state */ |
561 | if (L == NULL) { | 560 | if (L == NULL) { |
562 | l_message(argv[0], "cannot create state: not enough memory"); | 561 | l_message(argv[0], "cannot create state: not enough memory"); |
563 | return EXIT_FAILURE; | 562 | return EXIT_FAILURE; |
564 | } | 563 | } |
565 | s.argc = argc; | 564 | smain.argc = argc; |
566 | s.argv = argv; | 565 | smain.argv = argv; |
567 | status = lua_cpcall(L, pmain, &s); | 566 | status = lua_cpcall(L, pmain, NULL); |
568 | report(L, status); | 567 | report(L, status); |
569 | lua_close(L); | 568 | lua_close(L); |
570 | return (status || s.status) ? EXIT_FAILURE : EXIT_SUCCESS; | 569 | return (status || smain.status) ? EXIT_FAILURE : EXIT_SUCCESS; |
571 | } | 570 | } |
572 | 571 | ||