From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: linux-mtd@lists.infradead.org
Subject: [PATCH] ubiupdatevol: make the -t parameter work again
Date: Wed, 17 Dec 2008 11:15:54 +0100 [thread overview]
Message-ID: <20081217101554.GA4999@www.tglx.de> (raw)
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>
---
ubi-utils/new-utils/src/ubiupdatevol.c | 13 +++++++++----
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;
}
--
1.5.6.5
next reply other threads:[~2008-12-17 10:16 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-12-17 10:15 Sebastian Andrzej Siewior [this message]
2009-01-20 11:25 ` [PATCH] ubiupdatevol: make the -t parameter work again Sebastian Andrzej Siewior
2009-01-20 11:33 ` Artem Bityutskiy
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=20081217101554.GA4999@www.tglx.de \
--to=bigeasy@linutronix.de \
--cc=linux-mtd@lists.infradead.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox