From b2d2abb802c0939afea228f6b0379e5a2cb7dc13 Mon Sep 17 00:00:00 2001
From: Adrian Hunter <ext-adrian.hunter@nokia.com>
Date: Thu, 31 Jan 2008 17:21:57 +0200
Subject: ubi-tools: fix ubinize

ubinize reserves 2 eraseblocks for the volume table at the start of the
output file and then never seeked back to the start of the file.

Signed-off-by: Adrian Hunter <ext-adrian.hunter@nokia.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
---
 ubi-utils/src/ubinize.c | 5 +++++
 1 file changed, 5 insertions(+)

(limited to 'ubi-utils')

diff --git a/ubi-utils/src/ubinize.c b/ubi-utils/src/ubinize.c
index 4c3fd97..9660b09 100644
--- a/ubi-utils/src/ubinize.c
+++ b/ubi-utils/src/ubinize.c
@@ -618,6 +618,11 @@ int main(int argc, char * const argv[])
 
 	verbose(args.verbose, "writing layout volume");
 
+	if (fseek(args.fp_out, 0, SEEK_SET) == -1) {
+		errmsg("cannot seek file \"%s\"", args.f_out);
+		goto out_dict;
+	}
+
 	err = ubigen_write_layout_vol(&ui, vtbl, args.fp_out);
 	if (err) {
 		errmsg("cannot write layout volume");
-- 
cgit v1.2.3