[PATCH][MTD-UTILS] ubi-tools: fix ubinize

Adrian Hunter ext-adrian.hunter at nokia.com
Thu Jan 31 10:21:57 EST 2008


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 at nokia.com>
---
 ubi-utils/src/ubinize.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

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");
-- 
1.4.4.2



More information about the linux-mtd mailing list