projects
/
openwrt.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
[etrax] Comment out a debug message on usb host driver
[openwrt.git]
/
package
/
mtd
/
src
/
mtd.c
diff --git
a/package/mtd/src/mtd.c
b/package/mtd/src/mtd.c
index
18c3e97
..
761139f
100644
(file)
--- a/
package/mtd/src/mtd.c
+++ b/
package/mtd/src/mtd.c
@@
-138,9
+138,11
@@
int mtd_write_buffer(int fd, const char *buf, int offset, int length)
static int
image_check(int imagefd, const char *mtd)
{
static int
image_check(int imagefd, const char *mtd)
{
+ int ret = 1;
#ifdef target_brcm
#ifdef target_brcm
- ret
urn
trx_check(imagefd, mtd, buf, &buflen);
+ ret
=
trx_check(imagefd, mtd, buf, &buflen);
#endif
#endif
+ return ret;
}
static int mtd_check(const char *mtd)
}
static int mtd_check(const char *mtd)
@@
-246,7
+248,7
@@
static int
mtd_write(int imagefd, const char *mtd)
{
int fd, result;
mtd_write(int imagefd, const char *mtd)
{
int fd, result;
- size_t r, w, e;
+ s
s
ize_t r, w, e;
fd = mtd_check_open(mtd);
if(fd < 0) {
fd = mtd_check_open(mtd);
if(fd < 0) {
@@
-263,11
+265,25
@@
mtd_write(int imagefd, const char *mtd)
for (;;) {
/* buffer may contain data already (from trx check) */
for (;;) {
/* buffer may contain data already (from trx check) */
- r = read(imagefd, buf + buflen, erasesize - buflen);
- if (r < 0)
- break;
+ do {
+ r = read(imagefd, buf + buflen, erasesize - buflen);
+ if (r < 0) {
+ if ((errno == EINTR) || (errno == EAGAIN))
+ continue;
+ else {
+ perror("read");
+ break;
+ }
+ }
+
+ if (r == 0)
+ break;
- buflen += r;
+ buflen += r;
+ } while (buflen < erasesize);
+
+ if (buflen == 0)
+ break;
if (jffs2file) {
if (memcmp(buf, JFFS2_EOF, sizeof(JFFS2_EOF)) == 0) {
if (jffs2file) {
if (memcmp(buf, JFFS2_EOF, sizeof(JFFS2_EOF)) == 0) {
@@
-309,10
+325,6
@@
mtd_write(int imagefd, const char *mtd)
}
w += buflen;
}
w += buflen;
- /* not enough data - eof */
- if (buflen < erasesize)
- break;
-
buflen = 0;
}
if (!quiet)
buflen = 0;
}
if (!quiet)
This page took
0.021137 seconds
and
4
git commands to generate.