diff options
author | Aaron Marcher <me@drkhsh.at> | 2017-08-08 12:53:27 +0200 |
---|---|---|
committer | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2017-08-10 11:46:49 +0200 |
commit | 76a55b190c3b15f512c1daf5976249b38db916d6 (patch) | |
tree | 108464c95e346a826c38a3f478fc996dfeff4c14 /ubi-utils/ubinfo.c | |
parent | 454a3d0b1ac413de3c32e4076ba74fdc70a8e973 (diff) |
mtd-utils: ubinfo: add parameter check
Adds a check if the UBI device number is specified when passing a volume
name as parameter.
This fixes an issue, where by default an inexistent UBI device named
"ubi-1" is selected because of missing checks.
Signed-off-by: Aaron Marcher <me@drkhsh.at>
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'ubi-utils/ubinfo.c')
-rw-r--r-- | ubi-utils/ubinfo.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/ubi-utils/ubinfo.c b/ubi-utils/ubinfo.c index 82d4f18..29530be 100644 --- a/ubi-utils/ubinfo.c +++ b/ubi-utils/ubinfo.c @@ -399,6 +399,12 @@ int main(int argc, char * const argv[]) goto out_libubi; } + if (args.vol_name && args.devn == -1) { + errmsg("volume name is specified, but UBI device number is not " + "(use -h for help)\n"); + goto out_libubi; + } + if (args.vol_name) { err = get_vol_id_by_name(libubi, args.devn, args.vol_name); if (err) |