Loading mtdutils/mtdutils.c +11 −2 Original line number Diff line number Diff line Loading @@ -406,6 +406,11 @@ static int write_block(MtdWriteContext *ctx, const char *data) if (pos == (off_t) -1) return 1; ssize_t size = partition->erase_size; char *verify = malloc(size); if (verify == NULL) return 1; while (pos + size <= (int) partition->size) { loff_t bpos = pos; int ret = ioctl(fd, MEMGETBADBLOCK, &bpos); Loading Loading @@ -434,7 +439,6 @@ static int write_block(MtdWriteContext *ctx, const char *data) pos, strerror(errno)); } char verify[size]; if (lseek(fd, pos, SEEK_SET) != pos || read(fd, verify, size) != size) { fprintf(stderr, "mtd: re-read error at 0x%08lx (%s)\n", Loading @@ -451,6 +455,7 @@ static int write_block(MtdWriteContext *ctx, const char *data) fprintf(stderr, "mtd: wrote block after %d retries\n", retry); } fprintf(stderr, "mtd: successfully wrote block at %llx\n", pos); free(verify); return 0; // Success! } Loading @@ -461,6 +466,8 @@ static int write_block(MtdWriteContext *ctx, const char *data) pos += partition->erase_size; } free(verify); // Ran out of space on the device errno = ENOSPC; return -1; Loading Loading @@ -675,7 +682,9 @@ int cmd_mtd_restore_raw_partition(const char *partition_name, const char *filena while (left < 0) left += block_size; while (left > 0) { len = read(fd, buf, left > (int)sizeof(buf) ? (int)sizeof(buf) : left); if (len <= 0){ if (len == 0) break; if (len < 0){ printf("error reading %s", filename); return -1; } Loading recovery.c +4 −1 Original line number Diff line number Diff line Loading @@ -950,7 +950,10 @@ main(int argc, char **argv) { } } if (status != INSTALL_SUCCESS && !is_user_initiated_recovery) ui_set_background(BACKGROUND_ICON_ERROR); if (status != INSTALL_SUCCESS && !is_user_initiated_recovery) { ui_set_show_text(1); ui_set_background(BACKGROUND_ICON_ERROR); } if (status != INSTALL_SUCCESS || ui_text_visible()) { prompt_and_wait(); } Loading Loading
mtdutils/mtdutils.c +11 −2 Original line number Diff line number Diff line Loading @@ -406,6 +406,11 @@ static int write_block(MtdWriteContext *ctx, const char *data) if (pos == (off_t) -1) return 1; ssize_t size = partition->erase_size; char *verify = malloc(size); if (verify == NULL) return 1; while (pos + size <= (int) partition->size) { loff_t bpos = pos; int ret = ioctl(fd, MEMGETBADBLOCK, &bpos); Loading Loading @@ -434,7 +439,6 @@ static int write_block(MtdWriteContext *ctx, const char *data) pos, strerror(errno)); } char verify[size]; if (lseek(fd, pos, SEEK_SET) != pos || read(fd, verify, size) != size) { fprintf(stderr, "mtd: re-read error at 0x%08lx (%s)\n", Loading @@ -451,6 +455,7 @@ static int write_block(MtdWriteContext *ctx, const char *data) fprintf(stderr, "mtd: wrote block after %d retries\n", retry); } fprintf(stderr, "mtd: successfully wrote block at %llx\n", pos); free(verify); return 0; // Success! } Loading @@ -461,6 +466,8 @@ static int write_block(MtdWriteContext *ctx, const char *data) pos += partition->erase_size; } free(verify); // Ran out of space on the device errno = ENOSPC; return -1; Loading Loading @@ -675,7 +682,9 @@ int cmd_mtd_restore_raw_partition(const char *partition_name, const char *filena while (left < 0) left += block_size; while (left > 0) { len = read(fd, buf, left > (int)sizeof(buf) ? (int)sizeof(buf) : left); if (len <= 0){ if (len == 0) break; if (len < 0){ printf("error reading %s", filename); return -1; } Loading
recovery.c +4 −1 Original line number Diff line number Diff line Loading @@ -950,7 +950,10 @@ main(int argc, char **argv) { } } if (status != INSTALL_SUCCESS && !is_user_initiated_recovery) ui_set_background(BACKGROUND_ICON_ERROR); if (status != INSTALL_SUCCESS && !is_user_initiated_recovery) { ui_set_show_text(1); ui_set_background(BACKGROUND_ICON_ERROR); } if (status != INSTALL_SUCCESS || ui_text_visible()) { prompt_and_wait(); } Loading