public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: Richard Titmuss <richard_titmuss@logitech.com>
To: linux-mtd@lists.infradead.org
Subject: [PATCH][MTD-UTILS] Allow an absent 'image' in the ubinize configuration.
Date: Tue, 23 Sep 2008 21:32:10 +0100	[thread overview]
Message-ID: <48D9524A.3050300@logitech.com> (raw)

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)

             reply	other threads:[~2008-09-23 20:32 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-23 20:32 Richard Titmuss [this message]
2008-09-24  6:59 ` [PATCH][MTD-UTILS] Allow an absent 'image' in the ubinize configuration Artem Bityutskiy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=48D9524A.3050300@logitech.com \
    --to=richard_titmuss@logitech.com \
    --cc=linux-mtd@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox