summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjørn Mork <bjorn@mork.no>2017-04-22 15:55:33 +0200
committerBjørn Mork <bjorn@mork.no>2017-04-22 15:55:33 +0200
commit3aaa2d2259ef043248ab42676fe1aa3e083c2596 (patch)
treeb35837b86672bebfb15fc86099a461d18aaf3215
parentd00b93d64ebfc4425b86bb82024fcd17658c8e6a (diff)
ubnt-bs: fix open read only
Signed-off-by: Bjørn Mork <bjorn@mork.no>
-rw-r--r--ubnt-bs/src/ubnt-bs.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/ubnt-bs/src/ubnt-bs.c b/ubnt-bs/src/ubnt-bs.c
index 6649045..f8a9879 100644
--- a/ubnt-bs/src/ubnt-bs.c
+++ b/ubnt-bs/src/ubnt-bs.c
@@ -98,14 +98,15 @@ static int mtd_open(const char *mtd, struct mtd_info_user *info)
return -1;
snprintf(buf, sizeof(buf),"/dev/mtd%d", i);
- fd = open(buf, O_RDWR | O_SYNC);
+// fd = open(buf, O_RDWR | O_SYNC);
+ fd = open(buf, O_RDONLY | O_SYNC);
if (fd < 0) {
- fprintf(stderr, "Could not open mtd device: %s\n", mtd);
+ fprintf(stderr, "Could not open mtd device: %s\n", buf);
return fd;
}
if (ioctl(fd, MEMGETINFO, info)) {
- fprintf(stderr, "Could not get mtd info from %s\n", mtd);
+ fprintf(stderr, "Could not get mtd info from %s\n", buf);
close(fd);
return -1;
}