1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

cov: use literal for printf format

Prepare suffix ahead and use literal for printf().
This commit is contained in:
Zdenek Kabelac 2024-05-06 22:41:58 +02:00
parent f6e0e7b9aa
commit d7c2fe9723

View File

@ -968,10 +968,13 @@ static char *_generate_raid_name(struct logical_volume *lv,
{
char name[NAME_LEN], *lvname;
int historical;
char count_suffix[16] = { 0 };
if (dm_snprintf(name, sizeof(name),
(count >= 0) ? "%s_%s_%u" : "%s_%s",
lv->name, suffix, count) < 0) {
if (count >= 0)
snprintf(count_suffix, sizeof(count_suffix), "_%u", (unsigned)count);
if (dm_snprintf(name, sizeof(name), "%s_%s%s",
lv->name, suffix, count_suffix) < 0) {
log_error("Failed to new raid name for %s.",
display_lvname(lv));
return NULL;