Patchwork [1/4] util/envlist: Properly forward a callback's error in envlist_parse.

login
register
mail settings
Submitter Thomas Schwinge
Date May 29, 2013, 1:50 p.m.
Message ID <1369835434-27727-2-git-send-email-thomas@codesourcery.com>
Download mbox | patch
Permalink /patch/247394/
State New
Headers show

Comments

Thomas Schwinge - May 29, 2013, 1:50 p.m.
Signed-off-by: Thomas Schwinge <thomas@codesourcery.com>
---
 util/envlist.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
Peter Maydell - June 27, 2013, 5:36 p.m.
On 29 May 2013 14:50, Thomas Schwinge <thomas@codesourcery.com> wrote:
> Signed-off-by: Thomas Schwinge <thomas@codesourcery.com>

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

> ---
>  util/envlist.c |    5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git util/envlist.c util/envlist.c
> index ebc06cf..cbbf7e5 100644
> --- util/envlist.c
> +++ util/envlist.c

NB: your process for generating patch mails seems to be slightly
wrong -- the diff header in a patch mail should look like this:
diff --git a/util/envlist.c b/util/envlist.c
index ebc06cf..cbbf7e5 100644
--- a/util/envlist.c
+++ b/util/envlist.c

(note the extra 'a' and 'b'); otherwise 'git am patch.mbox'
will complain when you try to apply the patch.

thanks
-- PMM

Patch

diff --git util/envlist.c util/envlist.c
index ebc06cf..cbbf7e5 100644
--- util/envlist.c
+++ util/envlist.c
@@ -109,9 +109,10 @@  envlist_parse(envlist_t *envlist, const char *env,
 
 	envvar = strtok_r(tmpenv, ",", &envsave);
 	while (envvar != NULL) {
-		if ((*callback)(envlist, envvar) != 0) {
+		int err;
+		if ((err = (*callback)(envlist, envvar)) != 0) {
 			free(tmpenv);
-			return (errno);
+			return (err);
 		}
 		envvar = strtok_r(NULL, ",", &envsave);
 	}