From: Alasdair Kergon Date: Mon, 11 Oct 2004 15:59:23 +0000 (+0000) Subject: Fix size of dm_name string. X-Git-Tag: v2_02_91~5076 X-Git-Url: https://sourceware.org/git/?a=commitdiff_plain;h=56f5c04d5baccad70eed6dd69f73ab775af218e8;p=lvm2.git Fix size of dm_name string. --- diff --git a/WHATS_NEW b/WHATS_NEW index c7a5d0b64..d9a521b83 100644 --- a/WHATS_NEW +++ b/WHATS_NEW @@ -1,10 +1,10 @@ Version 2.00.26 - ===================================== + Fix dm_name string size calculation. Improve clvmd error reporting during startup. Make clvmd cope with large gaps in node numbers IDs. Make clvmd initialisation cope better with debugging output. clvmd -V now displays lvm version too. - Version 2.00.25 - 29th September 2004 ===================================== diff --git a/lib/misc/lvm-string.c b/lib/misc/lvm-string.c index a3028dafc..652dce0de 100644 --- a/lib/misc/lvm-string.c +++ b/lib/misc/lvm-string.c @@ -134,17 +134,19 @@ static void _quote_hyphens(char **out, const char *src) char *build_dm_name(struct pool *mem, const char *vg, const char *lv, const char *layer) { - size_t len = 0; - int hyphens = 0; + size_t len = 1; + int hyphens = 1; char *r, *out; _count_hyphens(vg, &len, &hyphens); _count_hyphens(lv, &len, &hyphens); - if (layer && *layer) + if (layer && *layer) { _count_hyphens(layer, &len, &hyphens); + hyphens++; + } - len += hyphens + 2; + len += hyphens; if (!(r = pool_alloc(mem, len))) { stack;