summaryrefslogtreecommitdiff
path: root/lib/libmtd_legacy.c
diff options
context:
space:
mode:
authorBrian Norris <computersforpeace@gmail.com>2012-02-08 13:26:21 -0800
committerArtem Bityutskiy <artem.bityutskiy@linux.intel.com>2012-02-29 09:19:17 +0200
commitac10be41ad321752682f2549ebc42b2512012f60 (patch)
tree54ffdd803195a2d5e1a1a489d20a4b29d77128e7 /lib/libmtd_legacy.c
parentc3e2250260f9ab7846cea5ae974ddb7379a8fef6 (diff)
libmtd_legacy: don't open device in R/W
On legacy kernels with ROM devices, we can get mtdinfo errors like: libmtd: error!: cannot open "/dev/mtd4" error 13 (Permission denied) mtdinfo: error!: libmtd failed get MTD device 4 information error 13 (Permission denied) We don't need O_RDRW access for informational ioctls(), so make this O_RDONLY. Signed-off-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Diffstat (limited to 'lib/libmtd_legacy.c')
-rw-r--r--lib/libmtd_legacy.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/libmtd_legacy.c b/lib/libmtd_legacy.c
index d3f1672..1ae9946 100644
--- a/lib/libmtd_legacy.c
+++ b/lib/libmtd_legacy.c
@@ -262,7 +262,7 @@ int legacy_get_dev_info(const char *node, struct mtd_dev_info *mtd)
mtd->mtd_num = mtd->minor / 2;
- fd = open(node, O_RDWR);
+ fd = open(node, O_RDONLY);
if (fd == -1)
return sys_errmsg("cannot open \"%s\"", node);