summaryrefslogtreecommitdiffstats
path: root/txr.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2016-05-05 06:38:59 -0700
committerKaz Kylheku <kaz@kylheku.com>2016-05-05 06:38:59 -0700
commitb897159ece19148faf414aec5fb6b7baac0fa301 (patch)
treed22a8d1dcc26deb7f33424fe6875079c6bc28627 /txr.c
parent7de3d60457b9746b31781522be6ea9e0b1438a86 (diff)
downloadtxr-b897159ece19148faf414aec5fb6b7baac0fa301.tar.gz
txr-b897159ece19148faf414aec5fb6b7baac0fa301.tar.bz2
txr-b897159ece19148faf414aec5fb6b7baac0fa301.zip
New --reexec option.
This helps with setuid hash bang scripting on Mac OS, and other plaforms where the interpreter executed out of a hash bang script runs with orinary privilege, even if marked setuid. * sysif.c (exec_wrap): Static function turns extern. * sysif.h (exec-wrap): Declared. * txr.1: Documented --reexec. Added notes about setuid under Hash Bang Support. * txr.c (help): List --reexec option. (txr_main): Implement --reexec option.
Diffstat (limited to 'txr.c')
-rw-r--r--txr.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/txr.c b/txr.c
index 5a79611e..b8e6267f 100644
--- a/txr.c
+++ b/txr.c
@@ -153,6 +153,9 @@ static void help(void)
"--compat=N Synonym for -C N\n"
"--gc-delta=N Invoke garbage collection when malloc activity\n"
" increments by N megabytes since last collection.\n"
+#if HAVE_FORK_STUFF
+"--reexec Re-execute TXR with remaining arguments.\n"
+#endif
"--debug-autoload Allow debugger to step through library auto-loading.\n"
"--debug-expansion Allow debugger to step through macro-expansion of query.\n"
"--yydebug Debug Yacc parser, if compiled with YYDEBUG support.\n"
@@ -603,6 +606,11 @@ int txr_main(int argc, char **argv)
} else if (equal(opt, lit("lisp"))) {
txr_lisp_p = t;
continue;
+#if HAVE_FORK_STUFF
+ } else if (equal(opt, lit("reexec"))) {
+ exec_wrap(prog_path, arg_list);
+ return EXIT_FAILURE;
+#endif
} else if (equal(opt, lit("debugger"))) {
drop_privilege();
#if CONFIG_DEBUG_SUPPORT