All of lore.kernel.org
 help / color / mirror / Atom feed
From: Steven A. Falco <sfalco@harris.com>
To: u-boot@lists.denx.de
Subject: [U-Boot-Users] Patch to setenv() to return status
Date: Thu, 12 Jun 2008 13:22:12 -0400	[thread overview]
Message-ID: <48515B44.7080407@harris.com> (raw)


Currently, the setenv function does not return an error code.  I'd like to
propose the following patch, because I want to be able to test for errors in
a new BSP I'm writing.

Comments invited.

Signed-off-by: Steve Falco <sfalco@harris.com>

diff --git a/include/common.h b/include/common.h
index d0f5704..e2dfc83 100644
--- a/include/common.h
+++ b/include/common.h
@@ -232,9 +232,9 @@ char	*getenv	     (char *);
 int	getenv_r     (char *name, char *buf, unsigned len);
 int	saveenv	     (void);
 #ifdef CONFIG_PPC		/* ARM version to be fixed! */
-void inline setenv   (char *, char *);
+int inline setenv   (char *, char *);
 #else
-void	setenv	     (char *, char *);
+int	setenv	     (char *, char *);
 #ifdef CONFIG_HAS_UID
 void	forceenv     (char *, char *);
 #endif
diff --git a/include/exports.h b/include/exports.h
index d6512cb..6377875 100644
--- a/include/exports.h
+++ b/include/exports.h
@@ -22,7 +22,7 @@ void vprintf(const char *, va_list);
 void do_reset (void);
 unsigned long simple_strtoul(const char *cp,char **endp,unsigned int base);
 char *getenv (char *name);
-void setenv (char *varname, char *varvalue);
+int setenv (char *varname, char *varvalue);
 long simple_strtol(const char *cp,char **endp,unsigned int base);
 int strcmp(const char * cs,const char * ct);
 #ifdef CONFIG_HAS_UID
diff --git a/include/asm-arm/u-boot-arm.h b/include/asm-arm/u-boot-arm.h
index 41e7a8f..4ee5a32 100644
--- a/include/asm-arm/u-boot-arm.h
+++ b/include/asm-arm/u-boot-arm.h
@@ -52,7 +52,7 @@ void	setup_revision_tag (struct tag **params);
 /* To be fixed!							*/
 /* ------------------------------------------------------------ */
 /* common/cmd_nvedit.c */
-void	setenv		(char *, char *);
+int	setenv		(char *, char *);
 
 /* cpu/.../interrupt.c */
 void	reset_timer_masked	(void);
diff --git a/common/cmd_nvedit.c b/common/cmd_nvedit.c
index 9c5d1fc..1ac91ea 100644
--- a/common/cmd_nvedit.c
+++ b/common/cmd_nvedit.c
@@ -379,13 +380,13 @@ int _do_setenv (int flag, int argc, char *argv[])
 	return 0;
 }
 
-void setenv (char *varname, char *varvalue)
+int setenv (char *varname, char *varvalue)
 {
 	char *argv[4] = { "setenv", varname, varvalue, NULL };
 	if (varvalue == NULL)
-		_do_setenv (0, 2, argv);
+		return _do_setenv (0, 2, argv);
 	else
-		_do_setenv (0, 3, argv);
+		return _do_setenv (0, 3, argv);
 }
 
 #ifdef CONFIG_HAS_UID

             reply	other threads:[~2008-06-12 17:22 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-12 17:22 Steven A. Falco [this message]
2008-07-05 22:32 ` [U-Boot-Users] Patch to setenv() to return status Wolfgang Denk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=48515B44.7080407@harris.com \
    --to=sfalco@harris.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.