From 56f5c04d5baccad70eed6dd69f73ab775af218e8 Mon Sep 17 00:00:00 2001 From: Alasdair Kergon Date: Mon, 11 Oct 2004 15:59:23 +0000 Subject: [PATCH] Fix size of dm_name string. --- WHATS_NEW | 2 +- lib/misc/lvm-string.c | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) 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; -- 2.43.5