From: Brian Norris <computersforpeace@gmail.com>
To: Artem Bityutskiy <dedekind1@gmail.com>
Cc: Brian Foster <brian.foster@maxim-ic.com>,
Brian Norris <computersforpeace@gmail.com>,
linux-mtd@lists.infradead.org
Subject: [PATCH 2/3] libmtd_legacy: don't open device in R/W
Date: Wed, 8 Feb 2012 13:26:21 -0800 [thread overview]
Message-ID: <1328736382-5798-2-git-send-email-computersforpeace@gmail.com> (raw)
In-Reply-To: <1328736382-5798-1-git-send-email-computersforpeace@gmail.com>
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>
---
lib/libmtd_legacy.c | 2 +-
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);
--
1.7.5.4
next prev parent reply other threads:[~2012-02-08 21:28 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-08 21:26 [PATCH 1/3] libmtd: perform device checking first Brian Norris
2012-02-08 21:26 ` Brian Norris [this message]
2012-02-08 21:26 ` [PATCH 3/3] libmtd: fix segmentation fault on lib->mtd Brian Norris
2012-02-09 12:05 ` [PATCH 1/3] libmtd: perform device checking first Artem Bityutskiy
2012-02-09 12:07 ` Artem Bityutskiy
2012-02-09 18:14 ` Brian Norris
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1328736382-5798-2-git-send-email-computersforpeace@gmail.com \
--to=computersforpeace@gmail.com \
--cc=brian.foster@maxim-ic.com \
--cc=dedekind1@gmail.com \
--cc=linux-mtd@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox