Patchwork [U-Boot] mkenvimage: fix usage message

login
register
mail settings
Submitter Wolfgang Denk
Date March 2, 2012, 7:19 a.m.
Message ID <1330672780-21028-1-git-send-email-wd@denx.de>
Download mbox | patch
Permalink /patch/144150/
State Accepted
Commit e758a5c4a75eb0d29201422ffc97ef7d95a88df8
Delegated to: Anatolij Gustschin
Headers show

Comments

Wolfgang Denk - March 2, 2012, 7:19 a.m.
Don;t use argv[0] for usage() because it may or may not be clobbered
by the previous call to basename().  Use "prg" instead as it is done
in the rest of the code.

Signed-off-by: Wolfgang Denk <wd@denx.de>
---
 tools/mkenvimage.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Mike Frysinger - March 2, 2012, 6:39 p.m.
On Friday 02 March 2012 02:19:40 Wolfgang Denk wrote:
> Don;t use argv[0] for usage() because it may or may not be clobbered

Don't

> by the previous call to basename().  Use "prg" instead as it is done
> in the rest of the code.

Acked-by: Mike Frysinger <vapier@gentoo.org>
-mike
Anatolij Gustschin - March 26, 2012, 11:24 a.m.
Hello Wolfgang,

On Fri,  2 Mar 2012 08:19:40 +0100
Wolfgang Denk <wd@denx.de> wrote:

> Don;t use argv[0] for usage() because it may or may not be clobbered
> by the previous call to basename().  Use "prg" instead as it is done
> in the rest of the code.
> 
> Signed-off-by: Wolfgang Denk <wd@denx.de>
> ---
>  tools/mkenvimage.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)

Applied to u-boot-staging.

Thanks,
Anatolij

Patch

diff --git a/tools/mkenvimage.c b/tools/mkenvimage.c
index f781731..64f5340 100644
--- a/tools/mkenvimage.c
+++ b/tools/mkenvimage.c
@@ -123,7 +123,7 @@  int main(int argc, char **argv)
 		case ':':
 			fprintf(stderr, "Missing argument for option -%c\n",
 				optopt);
-			usage(argv[0]);
+			usage(prg);
 			return EXIT_FAILURE;
 		default:
 			fprintf(stderr, "Wrong option -%c\n", optopt);