From 6979325592dd421ae4b02817ac8ac9ba5f362382 Mon Sep 17 00:00:00 2001 From: Matt Reimer Date: Wed, 30 May 2012 10:31:13 -0400 Subject: nanddump: make dumping read-only partitions work Make dumping read-only partitions work by opening the device O_RDONLY; otherwise the open() will fail with -EPERM. Signed-off-by: Matt Reimer Signed-off-by: Denys Vlasenko --- miscutils/nandwrite.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'miscutils') diff --git a/miscutils/nandwrite.c b/miscutils/nandwrite.c index 2ba6e3fe5..c636a5aa2 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); -- cgit v1.2.3