diff options
author | Sami Tolvanen <samitolvanen@google.com> | 2015-04-27 11:24:29 +0100 |
---|---|---|
committer | Sami Tolvanen <samitolvanen@google.com> | 2015-05-29 09:02:14 +0100 |
commit | 92eea1bc414a7b6faedaf812c33ede17403fcaf7 (patch) | |
tree | 7a45906571262ab88d182583850b31956af1af5d /updater | |
parent | 158e11d6738a751b754d09df7275add589c31191 (diff) | |
download | bootable_recovery-92eea1bc414a7b6faedaf812c33ede17403fcaf7.zip bootable_recovery-92eea1bc414a7b6faedaf812c33ede17403fcaf7.tar.gz bootable_recovery-92eea1bc414a7b6faedaf812c33ede17403fcaf7.tar.bz2 |
Handle BLKDISCARD failures
In the block updater, if BLKDISCARD fails, the error is silently
ignored and some of the blocks may not be erased. This means the
target partition will have inconsistent contents.
If the ioctl fails, return an error and abort the update.
Bug: 20614277
Change-Id: I33867ba9337c514de8ffae59f28584b285324067
(cherry picked from commit cc2428c8181d18c9a88db908fa4eabd2db5601ad)
Diffstat (limited to 'updater')
-rw-r--r-- | updater/blockimg.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/updater/blockimg.c b/updater/blockimg.c index a0e9aec..0e2ba44 100644 --- a/updater/blockimg.c +++ b/updater/blockimg.c @@ -1424,7 +1424,6 @@ static int PerformCommandErase(CommandParameters* params) { if (!S_ISBLK(st.st_mode)) { fprintf(stderr, "not a block device; skipping erase\n"); - rc = 0; goto pceout; } @@ -1448,7 +1447,7 @@ static int PerformCommandErase(CommandParameters* params) { if (ioctl(params->fd, BLKDISCARD, &blocks) == -1) { fprintf(stderr, "BLKDISCARD ioctl failed: %s\n", strerror(errno)); - // Continue anyway, nothing we can do + goto pceout; } } } |