Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 434434a7 authored by Koushik Dutta's avatar Koushik Dutta
Browse files

Merge branch 'gingerbread' of...

Merge branch 'gingerbread' of git://github.com/CyanogenMod/android_bootable_recovery into gingerbread
parents 0dc47ae3 2b56f849
Loading
Loading
Loading
Loading
+11 −2
Original line number Diff line number Diff line
@@ -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);
@@ -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",
@@ -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!
        }

@@ -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;
@@ -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;
        }
+4 −1
Original line number Diff line number Diff line
@@ -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();
    }