From 4a9dfc34553e74c1cbf367fabc977888f0607125 Mon Sep 17 00:00:00 2001
From: landley <landley@69ca8d6d-28ef-0310-b511-8ec308f3f277>
Date: Sat, 1 Jul 2006 17:19:02 +0000
Subject: Patch from Shaun Jackman moving the var=value logic to here it can do
 some good.

git-svn-id: svn://busybox.net/trunk/busybox@15575 69ca8d6d-28ef-0310-b511-8ec308f3f277
---
 shell/lash.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

(limited to 'shell')

diff --git a/shell/lash.c b/shell/lash.c
index 1b34052a1..83baee29d 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;
-- 
cgit v1.2.3-55-g6feb