public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH][MTD-UTILS] Allow an absent 'image' in the ubinize configuration.
@ 2008-09-23 20:32 Richard Titmuss
  2008-09-24  6:59 ` Artem Bityutskiy
  0 siblings, 1 reply; 2+ messages in thread
From: Richard Titmuss @ 2008-09-23 20:32 UTC (permalink / raw)
  To: linux-mtd

Hi,

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>

diff --git a/ubi-utils/new-utils/src/ubinize.c 
b/ubi-utils/new-utils/src/ubinize.c
index 5115db3..ebd5aa0 100644
--- a/ubi-utils/new-utils/src/ubinize.c
+++ b/ubi-utils/new-utils/src/ubinize.c
@@ -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)

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH][MTD-UTILS] Allow an absent 'image' in the ubinize configuration.
  2008-09-23 20:32 [PATCH][MTD-UTILS] Allow an absent 'image' in the ubinize configuration Richard Titmuss
@ 2008-09-24  6:59 ` Artem Bityutskiy
  0 siblings, 0 replies; 2+ messages in thread
From: Artem Bityutskiy @ 2008-09-24  6:59 UTC (permalink / raw)
  To: Richard Titmuss; +Cc: linux-mtd


On Tue, 2008-09-23 at 21:32 +0100, Richard Titmuss wrote:
> 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>

The patch did not apply cleanly, probably because your e-mail client
wrapped it. But after some hand-work I've applied it and pushed.

Thanks.

-- 
Best regards,
Artem Bityutskiy (Битюцкий Артём)

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-09-24  6:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-09-23 20:32 [PATCH][MTD-UTILS] Allow an absent 'image' in the ubinize configuration Richard Titmuss
2008-09-24  6:59 ` Artem Bityutskiy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox