[PATCH] ubiformat: open flash image readonly

Sascha Hauer s.hauer at pengutronix.de
Wed Feb 20 06:27:48 EST 2013


ubiformat only needs readonly access to the image to flash, so
open it readonly. Opening r/w may fail for example on tftp servers.

Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 commands/ubiformat.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/commands/ubiformat.c b/commands/ubiformat.c
index 3bb2c9a..efe1fde 100644
--- a/commands/ubiformat.c
+++ b/commands/ubiformat.c
@@ -233,7 +233,7 @@ static int open_file(off_t *sz)
 		return sys_errmsg("cannot open \"%s\"", args.image);
 
 	*sz = st.st_size;
-	fd  = open(args.image, O_RDWR);
+	fd  = open(args.image, O_RDONLY);
 	if (fd < 0)
 		return sys_errmsg("cannot open \"%s\"", args.image);
 
-- 
1.7.10.4




More information about the barebox mailing list