]> www.infradead.org Git - mtd-utils.git/commitdiff
ubinize: allow an absent 'image' in the ubinize configuration.
authorRichard Titmuss <richard_titmuss@logitech.com>
Tue, 23 Sep 2008 20:32:10 +0000 (21:32 +0100)
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
Wed, 24 Sep 2008 06:58:18 +0000 (02:58 -0400)
Some recent changes to ubinize prevent the 'image' parameter from being
absent in the configuration file. The following patch fixes that.

Signed-off-by: Richard Titmuss <richard.titmuss@logitech.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
ubi-utils/new-utils/src/ubinize.c

index 5115db3d42b54adf719c1f7f028de04519d47d48..ebd5aa041432514337b48651ed8261f2def110e3 100644 (file)
@@ -561,20 +561,22 @@ int main(int argc, char * const argv[])
                        goto out_free;
                }
 
-               fd = open(img, O_RDONLY);
-               if (fd == -1) {
-                       sys_errmsg("cannot open \"%s\"", img);
-                       goto out_free;
-               }
+               if (img) {
+                       fd = open(img, O_RDONLY);
+                       if (fd == -1) {
+                               sys_errmsg("cannot open \"%s\"", img);
+                               goto out_free;
+                       }
 
-               verbose(args.verbose, "writing volume %d", vi[i].id);
-               verbose(args.verbose, "image file: %s", img);
+                       verbose(args.verbose, "writing volume %d", vi[i].id);
+                       verbose(args.verbose, "image file: %s", img);
 
-               err = ubigen_write_volume(&ui, &vi[i], args.ec, st.st_size, fd, args.out_fd);
-               close(fd);
-               if (err) {
-                       errmsg("cannot write volume for section \"%s\"", sname);
-                       goto out_free;
+                       err = ubigen_write_volume(&ui, &vi[i], args.ec, st.st_size, fd, args.out_fd);
+                       close(fd);
+                       if (err) {
+                               errmsg("cannot write volume for section \"%s\"", sname);
+                               goto out_free;
+                       }
                }
 
                if (args.verbose)