diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2007-05-24 12:18:16 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2007-05-24 12:18:16 +0000 |
commit | b055001b6a69cf8fd513d36622cf693ee20c0e92 (patch) | |
tree | 13b92d347774d453d227b2f29dee695974a8727d /libbb/vfork_daemon_rexec.c | |
parent | 90e485ce79b8a0cd345bc5be76100291ec589579 (diff) | |
download | busybox-w32-b055001b6a69cf8fd513d36622cf693ee20c0e92.tar.gz busybox-w32-b055001b6a69cf8fd513d36622cf693ee20c0e92.tar.bz2 busybox-w32-b055001b6a69cf8fd513d36622cf693ee20c0e92.zip |
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.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/libbb/vfork_daemon_rexec.c b/libbb/vfork_daemon_rexec.c index a2572b0a9..349628796 100644 --- a/libbb/vfork_daemon_rexec.c +++ b/libbb/vfork_daemon_rexec.c | |||
@@ -103,6 +103,7 @@ int wait_pid(int *wstat, int pid) | |||
103 | #if ENABLE_FEATURE_PREFER_APPLETS | 103 | #if ENABLE_FEATURE_PREFER_APPLETS |
104 | void save_nofork_data(struct nofork_save_area *save) | 104 | void save_nofork_data(struct nofork_save_area *save) |
105 | { | 105 | { |
106 | memcpy(&save->die_jmp, &die_jmp, sizeof(die_jmp)); | ||
106 | save->current_applet = current_applet; | 107 | save->current_applet = current_applet; |
107 | save->xfunc_error_retval = xfunc_error_retval; | 108 | save->xfunc_error_retval = xfunc_error_retval; |
108 | save->option_mask32 = option_mask32; | 109 | save->option_mask32 = option_mask32; |
@@ -112,6 +113,7 @@ void save_nofork_data(struct nofork_save_area *save) | |||
112 | 113 | ||
113 | void restore_nofork_data(struct nofork_save_area *save) | 114 | void restore_nofork_data(struct nofork_save_area *save) |
114 | { | 115 | { |
116 | memcpy(&die_jmp, &save->die_jmp, sizeof(die_jmp)); | ||
115 | current_applet = save->current_applet; | 117 | current_applet = save->current_applet; |
116 | xfunc_error_retval = save->xfunc_error_retval; | 118 | xfunc_error_retval = save->xfunc_error_retval; |
117 | option_mask32 = save->option_mask32; | 119 | option_mask32 = save->option_mask32; |
@@ -147,7 +149,7 @@ int run_nofork_applet_prime(struct nofork_save_area *old, const struct bb_applet | |||
147 | rc = a->main(argc, tmp_argv); | 149 | rc = a->main(argc, tmp_argv); |
148 | } else { /* xfunc died in NOFORK applet */ | 150 | } else { /* xfunc died in NOFORK applet */ |
149 | /* in case they meant to return 0... */ | 151 | /* in case they meant to return 0... */ |
150 | if (rc == -111) | 152 | if (rc == -2222) |
151 | rc = 0; | 153 | rc = 0; |
152 | } | 154 | } |
153 | 155 | ||
@@ -159,6 +161,7 @@ int run_nofork_applet_prime(struct nofork_save_area *old, const struct bb_applet | |||
159 | int run_nofork_applet(const struct bb_applet *a, char **argv) | 161 | int run_nofork_applet(const struct bb_applet *a, char **argv) |
160 | { | 162 | { |
161 | struct nofork_save_area old; | 163 | struct nofork_save_area old; |
164 | |||
162 | /* Saving globals */ | 165 | /* Saving globals */ |
163 | save_nofork_data(&old); | 166 | save_nofork_data(&old); |
164 | return run_nofork_applet_prime(&old, a, argv); | 167 | return run_nofork_applet_prime(&old, a, argv); |