summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDoug Zongker <dougz@android.com>2010-09-10 02:01:49 +0200
committerAndroid Git Automerger <android-git-automerger@android.com>2010-09-10 02:01:49 +0200
commit0b519b25c3f441703e34854f2feffea90a3a91af (patch)
tree7585e06b1dd8e68aaa6e078140b2dd2096aa5f66
parentam 28cae98c: am 4bc98062: add --show_text option to recovery (diff)
parentam aaf3f56c: block is bad if ioctl() returns nonzero (diff)
downloadandroid_bootable_recovery-0b519b25c3f441703e34854f2feffea90a3a91af.tar
android_bootable_recovery-0b519b25c3f441703e34854f2feffea90a3a91af.tar.gz
android_bootable_recovery-0b519b25c3f441703e34854f2feffea90a3a91af.tar.bz2
android_bootable_recovery-0b519b25c3f441703e34854f2feffea90a3a91af.tar.lz
android_bootable_recovery-0b519b25c3f441703e34854f2feffea90a3a91af.tar.xz
android_bootable_recovery-0b519b25c3f441703e34854f2feffea90a3a91af.tar.zst
android_bootable_recovery-0b519b25c3f441703e34854f2feffea90a3a91af.zip
-rw-r--r--mtdutils/mtdutils.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/mtdutils/mtdutils.c b/mtdutils/mtdutils.c
index 18e6a5d63..3e354e334 100644
--- a/mtdutils/mtdutils.c
+++ b/mtdutils/mtdutils.c
@@ -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.
}