summaryrefslogtreecommitdiff
path: root/ubi-utils/new-utils/src/ubinize.c
diff options
context:
space:
mode:
authorRichard Titmuss <richard_titmuss@logitech.com>2008-09-23 21:32:10 +0100
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2008-09-24 02:58:18 -0400
commitd92356a3823632812b1094aead137cda827ff42e (patch)
treeda2c7b1d54abf5841392b8002a7e2d767ad02525 /ubi-utils/new-utils/src/ubinize.c
parent41c53b6f2d756ae995c3ffa4455576515427c5e0 (diff)
ubinize: allow an absent 'image' in the ubinize configuration.
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>
Diffstat (limited to 'ubi-utils/new-utils/src/ubinize.c')
-rw-r--r--ubi-utils/new-utils/src/ubinize.c26
1 files changed, 14 insertions, 12 deletions
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)