summaryrefslogtreecommitdiff
path: root/libbb/vfork_daemon_rexec.c
diff options
context:
space:
mode:
authorDenis Vlasenko2007-05-24 12:18:16 +0000
committerDenis Vlasenko2007-05-24 12:18:16 +0000
commitb055001b6a69cf8fd513d36622cf693ee20c0e92 (patch)
tree13b92d347774d453d227b2f29dee695974a8727d /libbb/vfork_daemon_rexec.c
parent90e485ce79b8a0cd345bc5be76100291ec589579 (diff)
downloadbusybox-b055001b6a69cf8fd513d36622cf693ee20c0e92.zip
busybox-b055001b6a69cf8fd513d36622cf693ee20c0e92.tar.gz
hush: fix handling of unmatched ${name (without closing '}') -
was eating all remaining input, potentially megabytes. nofork: save/restore die_jmp too nofork: use -2222 instead of -111 as "special" return valur for zero (-111 is used by some applets. -2222 won't fit in exitcode and thus safer)
Diffstat (limited to 'libbb/vfork_daemon_rexec.c')
-rw-r--r--libbb/vfork_daemon_rexec.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/libbb/vfork_daemon_rexec.c b/libbb/vfork_daemon_rexec.c
index a2572b0..3496287 100644
--- a/libbb/vfork_daemon_rexec.c
+++ b/libbb/vfork_daemon_rexec.c
@@ -103,6 +103,7 @@ int wait_pid(int *wstat, int pid)
#if ENABLE_FEATURE_PREFER_APPLETS
void save_nofork_data(struct nofork_save_area *save)
{
+ memcpy(&save->die_jmp, &die_jmp, sizeof(die_jmp));
save->current_applet = current_applet;
save->xfunc_error_retval = xfunc_error_retval;
save->option_mask32 = option_mask32;
@@ -112,6 +113,7 @@ void save_nofork_data(struct nofork_save_area *save)
void restore_nofork_data(struct nofork_save_area *save)
{
+ memcpy(&die_jmp, &save->die_jmp, sizeof(die_jmp));
current_applet = save->current_applet;
xfunc_error_retval = save->xfunc_error_retval;
option_mask32 = save->option_mask32;
@@ -147,7 +149,7 @@ int run_nofork_applet_prime(struct nofork_save_area *old, const struct bb_applet
rc = a->main(argc, tmp_argv);
} else { /* xfunc died in NOFORK applet */
/* in case they meant to return 0... */
- if (rc == -111)
+ if (rc == -2222)
rc = 0;
}
@@ -159,6 +161,7 @@ int run_nofork_applet_prime(struct nofork_save_area *old, const struct bb_applet
int run_nofork_applet(const struct bb_applet *a, char **argv)
{
struct nofork_save_area old;
+
/* Saving globals */
save_nofork_data(&old);
return run_nofork_applet_prime(&old, a, argv);