aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Andrzej Siewior <bigeasy@linutronix.de>2008-12-17 11:15:54 +0100
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2009-01-20 15:30:56 +0200
commita5d3a800db996aa81a07c0ae42240971460ac00d (patch)
tree79085dd67aa7ebb858c82f6f83dd5f668913db33
parentf6bd2c366b32262c2a5a1ac38713dc84bf7c9cbf (diff)
ubiupdatevol: fix -t parameter
The execution of |./ubiupdatevol /dev/ubi0 -t will fail because 'argv[optind + 1]' is undefined and the later executed 'strcmp(args.img, "-")' will segfault. So I can hack around and supply a dummy image or fix it that way. Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
-rw-r--r--ubi-utils/new-utils/src/ubiupdatevol.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/ubi-utils/new-utils/src/ubiupdatevol.c b/ubi-utils/new-utils/src/ubiupdatevol.c
index 5eeaa3c..c83731c 100644
--- a/ubi-utils/new-utils/src/ubiupdatevol.c
+++ b/ubi-utils/new-utils/src/ubiupdatevol.c
@@ -157,10 +157,15 @@ static int parse_opt(int argc, char * const argv[])
args.node = argv[optind];
args.img = argv[optind + 1];
- if (strcmp(args.img, "-") == 0)
- args.use_stdin = 1;
- if (args.use_stdin && !args.size)
- return errmsg("file size must be specified if input is stdin");
+ if (args.img && args.truncate)
+ return errmsg("You can't truncate and specify an image (use -h for help)");
+
+ if (args.img && !args.truncate) {
+ if (strcmp(args.img, "-") == 0)
+ args.use_stdin = 1;
+ if (args.use_stdin && !args.size)
+ return errmsg("file size must be specified if input is stdin");
+ }
return 0;
}