summaryrefslogtreecommitdiffstats
path: root/lib/format_text/text_label.c
diff options
context:
space:
mode:
authorAlasdair Kergon <agk@redhat.com>2006-05-09 21:23:51 +0000
committerAlasdair Kergon <agk@redhat.com>2006-05-09 21:23:51 +0000
commit72b2cb613a57918dadf9722c59a30ca71d751c8e (patch)
treeae0130e37b873591370abd65ff44cb2a554db049 /lib/format_text/text_label.c
parentb810c547004a98a7fc25c8dde65cf88d82ad9652 (diff)
downloadlvm2-72b2cb613a57918dadf9722c59a30ca71d751c8e.tar.gz
lvm2-72b2cb613a57918dadf9722c59a30ca71d751c8e.tar.xz
lvm2-72b2cb613a57918dadf9722c59a30ca71d751c8e.zip
Make SIZE_SHORT the default for display_size().
Fix some memory leaks in error paths found by coverity. Use C99 struct initialisers. Move DEFS into configure.h. Clean-ups to remove miscellaneous compiler warnings.
Diffstat (limited to 'lib/format_text/text_label.c')
-rw-r--r--lib/format_text/text_label.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/lib/format_text/text_label.c b/lib/format_text/text_label.c
index 0da605ef..92f9e415 100644
--- a/lib/format_text/text_label.c
+++ b/lib/format_text/text_label.c
@@ -27,7 +27,7 @@ static int _text_can_handle(struct labeller *l, char *buf, uint64_t sector)
{
struct label_header *lh = (struct label_header *) buf;
- if (!strncmp(lh->type, LVM2_LABEL, sizeof(lh->type)))
+ if (!strncmp((char *)lh->type, LVM2_LABEL, sizeof(lh->type)))
return 1;
return 0;
@@ -46,7 +46,7 @@ static int _text_write(struct label *label, char *buf)
/* FIXME Move to where label is created */
strncpy(label->type, LVM2_LABEL, sizeof(label->type));
- strncpy(lh->type, label->type, sizeof(label->type));
+ strncpy((char *)lh->type, label->type, sizeof(label->type));
pvhdr = (struct pv_header *) ((void *) buf + xlate32(lh->offset_xl));
info = (struct lvmcache_info *) label->info;
@@ -203,7 +203,7 @@ static int _text_read(struct labeller *l, struct device *dev, char *buf,
pvhdr = (struct pv_header *) ((void *) buf + xlate32(lh->offset_xl));
- if (!(info = lvmcache_add(l, pvhdr->pv_uuid, dev, NULL, NULL, 0)))
+ if (!(info = lvmcache_add(l, (char *)pvhdr->pv_uuid, dev, NULL, NULL, 0)))
return_0;
*label = info->label;
@@ -264,13 +264,13 @@ static void _fmt_text_destroy(struct labeller *l)
}
struct label_ops _text_ops = {
- can_handle:_text_can_handle,
- write:_text_write,
- read:_text_read,
- verify:_text_can_handle,
- initialise_label:_text_initialise_label,
- destroy_label:_text_destroy_label,
- destroy:_fmt_text_destroy
+ .can_handle = _text_can_handle,
+ .write = _text_write,
+ .read = _text_read,
+ .verify = _text_can_handle,
+ .initialise_label = _text_initialise_label,
+ .destroy_label = _text_destroy_label,
+ .destroy = _fmt_text_destroy,
};
struct labeller *text_labeller_create(const struct format_type *fmt)