summaryrefslogtreecommitdiff
path: root/shell
diff options
context:
space:
mode:
authorRob Landley2006-07-01 17:19:02 +0000
committerRob Landley2006-07-01 17:19:02 +0000
commit7a8e491dffe98ebc19fa83c2785c8477522e3270 (patch)
treee5cb1b6a36a37cc13c62e1e520f7712348da876a /shell
parent7ccb65f3a4f5c84d010978d450df57d3c1b13297 (diff)
downloadbusybox-7a8e491dffe98ebc19fa83c2785c8477522e3270.zip
busybox-7a8e491dffe98ebc19fa83c2785c8477522e3270.tar.gz
Patch from Shaun Jackman moving the var=value logic to here it can do some good.
Diffstat (limited to 'shell')
-rw-r--r--shell/lash.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/shell/lash.c b/shell/lash.c
index 1b34052..83baee2 100644
--- a/shell/lash.c
+++ b/shell/lash.c
@@ -1171,12 +1171,6 @@ static int pseudo_exec(struct child_prog *child)
{
struct built_in_command *x;
- /* Check if the command sets an environment variable. */
- if( strchr(child->argv[0], '=') != NULL ) {
- child->argv[1] = child->argv[0];
- _exit(builtin_export(child));
- }
-
/* Check if the command matches any of the non-forking builtins.
* Depending on context, this might be redundant. But it's
* easier to waste a few CPU cycles than it is to figure out
@@ -1300,6 +1294,12 @@ static int run_command(struct job *newjob, int inbg, int outpipe[2])
* is doomed to failure, and doesn't work on bash, either.
*/
if (newjob->num_progs == 1) {
+ /* Check if the command sets an environment variable. */
+ if (strchr(child->argv[0], '=') != NULL) {
+ child->argv[1] = child->argv[0];
+ return builtin_export(child);
+ }
+
for (x = bltins; x->cmd; x++) {
if (strcmp(child->argv[0], x->cmd) == 0 ) {
int rcode;