mirror of
git://sourceware.org/git/lvm2.git
synced 2025-03-10 16:58:47 +03:00
cleanup: we already know max device name size
Use NAME_LEN constant to simplify creation of device name. Since the max size should be already tested in validation, throw INTERNAL_ERROR if the size of vg/lv is bigger then NAME_LEN.
This commit is contained in:
parent
7aef45f9bb
commit
0558b1a086
@ -884,15 +884,13 @@ int lvconvert_poll(struct cmd_context *cmd, struct logical_volume *lv,
|
||||
* the polldaemon, lvconvert, pvmove code that a comprehensive
|
||||
* audit/rework is needed
|
||||
*/
|
||||
int len = strlen(lv->vg->name) + strlen(lv->name) + 2;
|
||||
char *uuid = alloca(sizeof(lv->lvid));
|
||||
char *lv_full_name = alloca(len);
|
||||
char uuid[sizeof(lv->lvid)];
|
||||
char lv_full_name[NAME_LEN];
|
||||
|
||||
if (!uuid || !lv_full_name)
|
||||
return_0;
|
||||
|
||||
if (dm_snprintf(lv_full_name, len, "%s/%s", lv->vg->name, lv->name) < 0)
|
||||
return_0;
|
||||
if (dm_snprintf(lv_full_name, sizeof(lv_full_name), "%s/%s", lv->vg->name, lv->name) < 0) {
|
||||
log_error(INTERNAL_ERROR "Name \"%s/%s\" is too long.", lv->vg->name, lv->name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
memcpy(uuid, &lv->lvid, sizeof(lv->lvid));
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user