diff options
author | Kay Sievers <kay.sievers@suse.de> | 2005-09-14 14:29:59 +0200 |
---|---|---|
committer | Kay Sievers <kay.sievers@suse.de> | 2005-09-14 14:29:59 +0200 |
commit | 726b21604aa5132090a6be1068da7f58069849ab (patch) | |
tree | 68ce92f439baf56983383a4a6b2d3e40a99e1e97 | |
parent | 129979643f5ae0363cef23978bce5d546be2f77d (diff) |
volume_id: fix error handling with failing read()
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
-rw-r--r-- | extras/volume_id/vol_id.c | 1 | ||||
-rw-r--r-- | extras/volume_id/volume_id/util.c | 6 |
2 files changed, 4 insertions, 3 deletions
diff --git a/extras/volume_id/vol_id.c b/extras/volume_id/vol_id.c index 3c75bdaa2f..2b53085c72 100644 --- a/extras/volume_id/vol_id.c +++ b/extras/volume_id/vol_id.c @@ -145,6 +145,7 @@ int main(int argc, char *argv[]) if (ioctl(vid->fd, BLKGETSIZE64, &size) != 0) size = 0; + dbg("BLKGETSIZE64=%llu", size); if (volume_id_probe_all(vid, 0, size) == 0) goto print; diff --git a/extras/volume_id/volume_id/util.c b/extras/volume_id/volume_id/util.c index 62b96a3657..d1271a86be 100644 --- a/extras/volume_id/volume_id/util.c +++ b/extras/volume_id/volume_id/util.c @@ -197,7 +197,7 @@ set: uint8_t *volume_id_get_buffer(struct volume_id *id, uint64_t off, size_t len) { - size_t buf_len; + ssize_t buf_len; dbg("get buffer off 0x%llx(%llu), len 0x%zx", (unsigned long long) off, (unsigned long long) off, len); /* check if requested area fits in superblock buffer */ @@ -224,7 +224,7 @@ uint8_t *volume_id_get_buffer(struct volume_id *id, uint64_t off, size_t len) } dbg("got 0x%zx (%zi) bytes", buf_len, buf_len); id->sbbuf_len = buf_len; - if (buf_len < off + len) { + if ((size_t)buf_len < off + len) { dbg("requested 0x%zx bytes, got only 0x%zx bytes", len, buf_len); return NULL; } @@ -261,7 +261,7 @@ uint8_t *volume_id_get_buffer(struct volume_id *id, uint64_t off, size_t len) dbg("got 0x%zx (%zi) bytes", buf_len, buf_len); id->seekbuf_off = off; id->seekbuf_len = buf_len; - if (buf_len < len) { + if ((size_t)buf_len < len) { dbg("requested 0x%zx bytes, got only 0x%zx bytes", len, buf_len); return NULL; } |