projects
/
librecmc
/
librecmc.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
mtd: use tabs for indents
[librecmc/librecmc.git]
/
package
/
system
/
mtd
/
src
/
mtd.c
diff --git
a/package/system/mtd/src/mtd.c
b/package/system/mtd/src/mtd.c
index eda001e1d8516313782bd317a6ab01d92b953b02..60ae7adcdfac56541deb6a460175679a91baaffa 100644
(file)
--- a/
package/system/mtd/src/mtd.c
+++ b/
package/system/mtd/src/mtd.c
@@
-179,14
+179,21
@@
image_check(int imagefd, const char *mtd)
{
uint32_t magic;
int ret = 1;
{
uint32_t magic;
int ret = 1;
+ int bufread;
+
+ while (buflen < sizeof(magic)) {
+ bufread = read(imagefd, buf + buflen, sizeof(magic) - buflen);
+ if (bufread < 1)
+ break;
+
+ buflen += bufread;
+ }
if (buflen < sizeof(magic)) {
if (buflen < sizeof(magic)) {
- buflen += read(imagefd, buf + buflen, sizeof(magic) - buflen);
- if (buflen < sizeof(magic)) {
- fprintf(stdout, "Could not get image magic\n");
- return 0;
- }
+ fprintf(stdout, "Could not get image magic\n");
+ return 0;
}
}
+
magic = ((uint32_t *)buf)[0];
if (be32_to_cpu(magic) == TRX_MAGIC)
magic = ((uint32_t *)buf)[0];
if (be32_to_cpu(magic) == TRX_MAGIC)
@@
-959,16
+966,16
@@
int main (int argc, char **argv)
mtd_write_jffs2(device, imagefile, jffs2dir);
break;
case CMD_FIXTRX:
mtd_write_jffs2(device, imagefile, jffs2dir);
break;
case CMD_FIXTRX:
- if (mtd_fixtrx) {
- mtd_fixtrx(device, offset);
- }
+
if (mtd_fixtrx) {
+
mtd_fixtrx(device, offset);
+
}
case CMD_RESETBC:
case CMD_RESETBC:
- if (mtd_resetbc) {
- mtd_resetbc(device);
- }
+
if (mtd_resetbc) {
+
mtd_resetbc(device);
+
}
case CMD_FIXSEAMA:
if (mtd_fixseama)
case CMD_FIXSEAMA:
if (mtd_fixseama)
- mtd_fixseama(device, 0);
+
mtd_fixseama(device, 0);
break;
}
break;
}