1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-23 21:35:29 +03:00

Fix table output bug in last commit.

This commit is contained in:
Alasdair Kergon 2003-02-20 13:30:03 +00:00
parent 1996230460
commit 7d9770b9a2

View File

@ -16,7 +16,6 @@
#include <errno.h> #include <errno.h>
#include <linux/limits.h> #include <linux/limits.h>
/* /*
* Ensure build compatibility. * Ensure build compatibility.
* The hard-coded versions here are the highest present * The hard-coded versions here are the highest present
@ -91,17 +90,18 @@ static int _unmarshal_status_v1(struct dm_task *dmt, struct dm_ioctl_v1 *dmi)
char *outbuf = (char *) dmi + sizeof(struct dm_ioctl_v1); char *outbuf = (char *) dmi + sizeof(struct dm_ioctl_v1);
char *outptr = outbuf; char *outptr = outbuf;
uint32_t i; uint32_t i;
struct dm_target_spec_v1 *spec = (struct dm_target_spec_v1 *) outptr; struct dm_target_spec_v1 *spec;
size_t spec_size = sizeof(struct dm_target_spec_v1);
for (i = 0; i < dmi->target_count; i++) { for (i = 0; i < dmi->target_count; i++) {
spec = (struct dm_target_spec_v1 *) outptr;
if (!dm_task_add_target(dmt, spec->sector_start, if (!dm_task_add_target(dmt, spec->sector_start,
(uint64_t) spec->length, (uint64_t) spec->length,
spec->target_type, outptr + spec_size)) spec->target_type,
outptr + sizeof(*spec)))
return 0; return 0;
outptr += spec_size; outptr += sizeof(*spec);
outptr += strlen(outptr) + 1; outptr += strlen(outptr) + 1;
_align(outptr, ALIGNMENT); _align(outptr, ALIGNMENT);
@ -472,16 +472,17 @@ static int _unmarshal_status(struct dm_task *dmt, struct dm_ioctl *dmi)
char *outbuf = (char *) dmi + sizeof(struct dm_ioctl); char *outbuf = (char *) dmi + sizeof(struct dm_ioctl);
char *outptr = outbuf; char *outptr = outbuf;
uint32_t i; uint32_t i;
struct dm_target_spec *spec = (struct dm_target_spec *) outptr; struct dm_target_spec *spec;
size_t spec_size = sizeof(struct dm_target_spec);
for (i = 0; i < dmi->target_count; i++) { for (i = 0; i < dmi->target_count; i++) {
spec = (struct dm_target_spec *) outptr;
if (!dm_task_add_target(dmt, spec->sector_start, if (!dm_task_add_target(dmt, spec->sector_start,
spec->length, spec->length,
spec->target_type, outptr + spec_size)) spec->target_type,
outptr + sizeof(*spec)))
return 0; return 0;
outptr += spec_size; outptr += sizeof(*spec);
outptr += strlen(outptr) + 1; outptr += strlen(outptr) + 1;
_align(outptr, ALIGNMENT); _align(outptr, ALIGNMENT);