projects
/
openwrt
/
staging
/
robimarko.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
ed1a641
)
fallback when devfs names aren't found
author
Mike Baker
<mbm@openwrt.org>
Fri, 9 Mar 2007 08:58:37 +0000
(08:58 +0000)
committer
Mike Baker
<mbm@openwrt.org>
Fri, 9 Mar 2007 08:58:37 +0000
(08:58 +0000)
SVN-Revision: 6541
package/mtd/src/mtd.c
patch
|
blob
|
history
diff --git
a/package/mtd/src/mtd.c
b/package/mtd/src/mtd.c
index 7d1e36010c5734af7265e385bbd05b980c3e7613..0a968409a8bb4a62710f243ab75789ac412209a9 100644
(file)
--- a/
package/mtd/src/mtd.c
+++ b/
package/mtd/src/mtd.c
@@
-197,13
+197,18
@@
mtd_open(const char *mtd, int flags)
FILE *fp;
char dev[PATH_MAX];
int i;
+ int ret;
if ((fp = fopen("/proc/mtd", "r"))) {
while (fgets(dev, sizeof(dev), fp)) {
if (sscanf(dev, "mtd%d:", &i) && strstr(dev, mtd)) {
snprintf(dev, sizeof(dev), "/dev/mtd/%d", i);
+ if ((ret=open(dev, flags))<0) {
+ snprintf(dev, sizeof(dev), "/dev/mtd%d", i);
+ ret=open(dev, flags);
+ }
fclose(fp);
- return
open(dev, flags)
;
+ return
ret
;
}
}
fclose(fp);