Merge commit 'a2c9a1e8a2b99bd8197c83b2f749ec61bc0312f8' * commit 'a2c9a1e8a2b99bd8197c83b2f749ec61bc0312f8': block is bad if ioctl() returns nonzero
This commit is contained in:
commit
0b519b25c3
@ -414,9 +414,12 @@ static int write_block(MtdWriteContext *ctx, const char *data)
|
||||
ssize_t size = partition->erase_size;
|
||||
while (pos + size <= (int) partition->size) {
|
||||
loff_t bpos = pos;
|
||||
if (ioctl(fd, MEMGETBADBLOCK, &bpos) > 0) {
|
||||
int ret = ioctl(fd, MEMGETBADBLOCK, &bpos);
|
||||
if (ret != 0 && !(ret == -1 && errno == EOPNOTSUPP)) {
|
||||
add_bad_block_offset(ctx, pos);
|
||||
fprintf(stderr, "mtd: not writing bad block at 0x%08lx\n", pos);
|
||||
fprintf(stderr,
|
||||
"mtd: not writing bad block at 0x%08lx (ret %d errno %d)\n",
|
||||
pos, ret, errno);
|
||||
pos += partition->erase_size;
|
||||
continue; // Don't try to erase known factory-bad blocks.
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user