diff mbox

[U-Boot] env: fix the env export varname

Message ID 4accd97bbc9fe967a5a9034deb6596a577936f20.1381233825.git.p.aubert@staubli.com
State Accepted
Delegated to: Tom Rini
Headers show

Commit Message

Pierre Aubert Oct. 8, 2013, 12:20 p.m. UTC
The env export command doesn't export the first variable of the list
since commit 5a31ea04c9ee5544fbb70ad7597ea4b294840eab
"env grep" - reimplement command using hexport_r()

Signed-off-by: Pierre Aubert <p.aubert@staubli.com>
---
 common/cmd_nvedit.c |    6 ++----
 lib/hashtable.c     |    2 +-
 2 files changed, 3 insertions(+), 5 deletions(-)

Comments

Tom Rini Nov. 8, 2013, 10:27 p.m. UTC | #1
On Tue, Oct 08, 2013 at 02:20:27PM +0200, Pierre Aubert wrote:

> The env export command doesn't export the first variable of the list
> since commit 5a31ea04c9ee5544fbb70ad7597ea4b294840eab
> "env grep" - reimplement command using hexport_r()
> 
> Signed-off-by: Pierre Aubert <p.aubert@staubli.com>

Applied to u-boot/master, thanks!
diff mbox

Patch

diff --git a/common/cmd_nvedit.c b/common/cmd_nvedit.c
index 778dca5..c249286 100644
--- a/common/cmd_nvedit.c
+++ b/common/cmd_nvedit.c
@@ -157,10 +157,8 @@  static int do_env_grep(cmd_tbl_t *cmdtp, int flag,
 	grep_how  = H_MATCH_SUBSTR;	/* default: substring search	*/
 	grep_what = H_MATCH_BOTH;	/* default: grep names and values */
 
-	while (argc > 1 && **(argv + 1) == '-') {
-		char *arg = *++argv;
-
-		--argc;
+	while (--argc > 0 && **++argv == '-') {
+		char *arg = *argv;
 		while (*++arg) {
 			switch (*arg) {
 #ifdef CONFIG_REGEX
diff --git a/lib/hashtable.c b/lib/hashtable.c
index c5a2b08..4356b23 100644
--- a/lib/hashtable.c
+++ b/lib/hashtable.c
@@ -564,7 +564,7 @@  static int match_entry(ENTRY *ep, int flag,
 	int arg;
 	void *priv = NULL;
 
-	for (arg = 1; arg < argc; ++arg) {
+	for (arg = 0; arg < argc; ++arg) {
 #ifdef CONFIG_REGEX
 		struct slre slre;