summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2017-09-27 12:53:58 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2017-09-27 14:02:20 +0200
commit02ade8d921def6b826163302afe6914a3543d175 (patch)
tree6eeff8079f12f0613655e5fc69e12964f7921ca7
parentbed2c7741b185d8242a70529bbfbcc20b3a84418 (diff)
downloadbarebox-02ade8d921def6b826163302afe6914a3543d175.tar.gz
usbgadget command: catch errors when parsing the file list
file_list_parse() can fail. Print an error message in this case instead of crashing. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r--commands/usbgadget.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/commands/usbgadget.c b/commands/usbgadget.c
index ba09f97..5935909 100644
--- a/commands/usbgadget.c
+++ b/commands/usbgadget.c
@@ -83,10 +83,14 @@ static int do_usbgadget(int argc, char *argv[])
if (fastboot_opts) {
opts->fastboot_opts.files = file_list_parse(fastboot_opts);
+ if (IS_ERR(opts->fastboot_opts.files))
+ goto err_parse;
}
if (dfu_opts) {
opts->dfu_opts.files = file_list_parse(dfu_opts);
+ if (IS_ERR(opts->dfu_opts.files))
+ goto err_parse;
}
if (create_serial) {
@@ -98,6 +102,13 @@ static int do_usbgadget(int argc, char *argv[])
usb_multi_opts_release(opts);
return ret;
+
+err_parse:
+ printf("Cannot parse file list \"%s\": %s\n", fastboot_opts, strerrorp(opts->fastboot_opts.files));
+
+ free(opts);
+
+ return 1;
}
BAREBOX_CMD_HELP_START(usbgadget)