[git commit] nanddump: make dumping read-only partitions work

Denys Vlasenko vda.linux at googlemail.com
Wed Jun 13 00:39:22 UTC 2012


commit: http://git.busybox.net/busybox/commit/?id=6979325592dd421ae4b02817ac8ac9ba5f362382
branch: http://git.busybox.net/busybox/commit/?id=refs/heads/master

Make dumping read-only partitions work by opening the device
O_RDONLY; otherwise the open() will fail with -EPERM.

Signed-off-by: Matt Reimer <mreimer at sdgsystems.com>
Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
 miscutils/nandwrite.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/miscutils/nandwrite.c b/miscutils/nandwrite.c
index 2ba6e3f..c636a5a 100644
--- a/miscutils/nandwrite.c
+++ b/miscutils/nandwrite.c
@@ -129,7 +129,7 @@ int nandwrite_main(int argc UNUSED_PARAM, char **argv)
 		xmove_fd(tmp_fd, IS_NANDDUMP ? STDOUT_FILENO : STDIN_FILENO);
 	}
 
-	fd = xopen(argv[0], O_RDWR);
+	fd = xopen(argv[0], IS_NANDWRITE ? O_RDWR : O_RDONLY);
 	xioctl(fd, MEMGETINFO, &meminfo);
 
 	mtdoffset = xstrtou(opt_s, 0);


More information about the busybox-cvs mailing list