]> www.infradead.org Git - mtd-utils.git/commitdiff
ubinize: Exit with non-zero exit code on error.
authorPatrick Doyle <wpdster@gmail.com>
Mon, 1 Jul 2019 18:25:28 +0000 (14:25 -0400)
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>
Tue, 2 Jul 2019 12:33:07 +0000 (14:33 +0200)
...specifically -1 in all of the new cases.

Signed-off-by: Patrick Doyle <pdoyle@irobot.com>
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
ubi-utils/ubinize.c

index b6036380373e4fd83e24ed45813bf416f888c45a..967b65cd0294d1824e3bb600f618331b2766dbbf 100644 (file)
@@ -442,11 +442,14 @@ int main(int argc, char * const argv[])
        verbose(args.verbose, "UBI image sequence number: %u", ui.image_seq);
 
        vtbl = ubigen_create_empty_vtbl(&ui);
-       if (!vtbl)
+       if (!vtbl) {
+               err = -1;
                goto out;
+       }
 
        args.dict = iniparser_load(args.f_in);
        if (!args.dict) {
+               err = -1;
                errmsg("cannot load the input ini file \"%s\"", args.f_in);
                goto out_vtbl;
        }
@@ -456,17 +459,20 @@ int main(int argc, char * const argv[])
        /* Each section describes one volume */
        sects = iniparser_getnsec(args.dict);
        if (sects == -1) {
+               err = -1;
                errmsg("ini-file parsing error (iniparser_getnsec)");
                goto out_dict;
        }
 
        verbose(args.verbose, "count of sections: %d", sects);
        if (sects == 0) {
+               err = -1;
                errmsg("no sections found the ini-file \"%s\"", args.f_in);
                goto out_dict;
        }
 
        if (sects > ui.max_volumes) {
+               err = -1;
                errmsg("too many sections (%d) in the ini-file \"%s\"",
                       sects, args.f_in);
                normsg("each section corresponds to an UBI volume, maximum "
@@ -476,6 +482,7 @@ int main(int argc, char * const argv[])
 
        vi = calloc(sizeof(struct ubigen_vol_info), sects);
        if (!vi) {
+               err = -1;
                errmsg("cannot allocate memory");
                goto out_dict;
        }