diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2009-02-15 05:51:19 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2009-02-15 05:51:19 +0000 |
commit | 28ea4298e380d73203890c0f42de68e9798396d8 (patch) | |
tree | 55c832fd42d8838f9d5f40d2b97bae93263e19e1 /util-linux/volume_id/util.c | |
parent | 93b38208d1e7d759b3c8ed8e7eb91c10442033ff (diff) | |
download | busybox-w32-28ea4298e380d73203890c0f42de68e9798396d8.tar.gz busybox-w32-28ea4298e380d73203890c0f42de68e9798396d8.tar.bz2 busybox-w32-28ea4298e380d73203890c0f42de68e9798396d8.zip |
volume_id: abort early on read failures.
should help with probing missing fdd's
Diffstat (limited to 'util-linux/volume_id/util.c')
-rw-r--r-- | util-linux/volume_id/util.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/util-linux/volume_id/util.c b/util-linux/volume_id/util.c index 1a1b3f92e..dd75c7ba1 100644 --- a/util-linux/volume_id/util.c +++ b/util-linux/volume_id/util.c | |||
@@ -254,9 +254,15 @@ void *volume_id_get_buffer(struct volume_id *id, uint64_t off, size_t len) | |||
254 | dbg("requested 0x%x bytes, got 0x%x bytes", | 254 | dbg("requested 0x%x bytes, got 0x%x bytes", |
255 | (unsigned) len, (unsigned) read_len); | 255 | (unsigned) len, (unsigned) read_len); |
256 | err: | 256 | err: |
257 | /* id->seekbuf_len or id->sbbuf_len is wrong now! Fixing. | 257 | /* No filesystem can be this tiny. It's most likely |
258 | * Most likely user will not do any additional | 258 | * non-associated loop device, empty drive and so on. |
259 | * calls anyway, it's a corrupted fs or something. */ | 259 | * Flag it, making it possible to short circuit future |
260 | * accesses. Rationale: | ||
261 | * users complained of slow blkid due to empty floppy drives. | ||
262 | */ | ||
263 | if (off < 64*1024) | ||
264 | id->error = 1; | ||
265 | /* id->seekbuf_len or id->sbbuf_len is wrong now! Fixing. */ | ||
260 | volume_id_free_buffer(id); | 266 | volume_id_free_buffer(id); |
261 | return NULL; | 267 | return NULL; |
262 | } | 268 | } |