From 874f42ad6ca7232195a4d5af2d109f279a4ab70e Mon Sep 17 00:00:00 2001 From: Alasdair Kergon Date: Tue, 2 Sep 2008 12:16:07 +0000 Subject: [PATCH] Extend deptree buffers so the largest possible device numbers fit. --- WHATS_NEW_DM | 1 + libdm/libdevmapper.h | 3 ++- libdm/libdm-deptree.c | 5 +++-- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/WHATS_NEW_DM b/WHATS_NEW_DM index 7f0807a4e..7c9daeeec 100644 --- a/WHATS_NEW_DM +++ b/WHATS_NEW_DM @@ -1,5 +1,6 @@ Version 1.02.28 - ================================ + Extend deptree buffers so the largest possible device numbers fit. Added generation of the versioned libdevmapper-event.so for LVM's test Underline longer report help text headings. diff --git a/libdm/libdevmapper.h b/libdm/libdevmapper.h index b62b4d90f..2f76552e3 100644 --- a/libdm/libdevmapper.h +++ b/libdm/libdevmapper.h @@ -181,8 +181,9 @@ int dm_task_add_target(struct dm_task *dmt, uint64_t size, const char *ttype, const char *params); /* - * Format major/minor numbers correctly for input to driver + * Format major/minor numbers correctly for input to driver. */ +#define DM_FORMAT_DEV_BUFSIZE 13 /* Minimum bufsize to handle worst case. */ int dm_format_dev(char *buf, int bufsize, uint32_t dev_major, uint32_t dev_minor); /* Use this to retrive target information returned from a STATUS call */ diff --git a/libdm/libdm-deptree.c b/libdm/libdm-deptree.c index c73ed50f4..8c4797d9e 100644 --- a/libdm/libdm-deptree.c +++ b/libdm/libdm-deptree.c @@ -1243,7 +1243,7 @@ static int _emit_areas_line(struct dm_task *dmt __attribute((unused)), size_t paramsize, int *pos) { struct seg_area *area; - char devbuf[10]; + char devbuf[DM_FORMAT_DEV_BUFSIZE]; int tw; const char *prefix = ""; @@ -1270,7 +1270,8 @@ static int _emit_segment_line(struct dm_task *dmt, struct load_segment *seg, uin int pos = 0; int tw; int r; - char originbuf[10], cowbuf[10], logbuf[10]; + char originbuf[DM_FORMAT_DEV_BUFSIZE], cowbuf[DM_FORMAT_DEV_BUFSIZE]; + char logbuf[DM_FORMAT_DEV_BUFSIZE]; const char *logtype; switch(seg->type) { -- 2.43.5