mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-18 10:04:20 +03:00
cleanup: all lvmcache_add users pass char with 0
No local copy needed, both users submit zero-end string as pv/vgid.
This commit is contained in:
parent
5ccb373d86
commit
79e65a3596
12
lib/cache/lvmcache.c
vendored
12
lib/cache/lvmcache.c
vendored
@ -2166,8 +2166,8 @@ struct lvmcache_info *lvmcache_add(struct cmd_context *cmd, struct labeller *lab
|
|||||||
const char *vgname, const char *vgid_arg, uint32_t vgstatus,
|
const char *vgname, const char *vgid_arg, uint32_t vgstatus,
|
||||||
int *is_duplicate)
|
int *is_duplicate)
|
||||||
{
|
{
|
||||||
char pvid[ID_LEN + 1] __attribute__((aligned(8))) = { 0 };
|
const char *pvid = pvid_arg;
|
||||||
char vgid[ID_LEN + 1] __attribute__((aligned(8))) = { 0 };
|
const char *vgid = vgid_arg;
|
||||||
char pvid_dashed[64] __attribute__((aligned(8)));
|
char pvid_dashed[64] __attribute__((aligned(8)));
|
||||||
struct lvmcache_vgsummary vgsummary = { 0 };
|
struct lvmcache_vgsummary vgsummary = { 0 };
|
||||||
struct lvmcache_info *info;
|
struct lvmcache_info *info;
|
||||||
@ -2175,12 +2175,6 @@ struct lvmcache_info *lvmcache_add(struct cmd_context *cmd, struct labeller *lab
|
|||||||
struct device_list *devl;
|
struct device_list *devl;
|
||||||
int created = 0;
|
int created = 0;
|
||||||
|
|
||||||
/* pvid_arg and vgid_arg may not be null terminated */
|
|
||||||
memcpy(pvid, pvid_arg, ID_LEN);
|
|
||||||
|
|
||||||
if (vgid_arg)
|
|
||||||
memcpy(vgid, vgid_arg, ID_LEN);
|
|
||||||
|
|
||||||
if (!id_write_format((const struct id *)&pvid, pvid_dashed, sizeof(pvid_dashed)))
|
if (!id_write_format((const struct id *)&pvid, pvid_dashed, sizeof(pvid_dashed)))
|
||||||
stack;
|
stack;
|
||||||
|
|
||||||
@ -2282,7 +2276,7 @@ struct lvmcache_info *lvmcache_add(struct cmd_context *cmd, struct labeller *lab
|
|||||||
update_vginfo:
|
update_vginfo:
|
||||||
vgsummary.vgstatus = vgstatus;
|
vgsummary.vgstatus = vgstatus;
|
||||||
vgsummary.vgname = vgname;
|
vgsummary.vgname = vgname;
|
||||||
if (vgid[0])
|
if (vgid && vgid[0])
|
||||||
memcpy(vgsummary.vgid, vgid, ID_LEN);
|
memcpy(vgsummary.vgid, vgid, ID_LEN);
|
||||||
|
|
||||||
if (!lvmcache_update_vgname_and_id(cmd, info, &vgsummary)) {
|
if (!lvmcache_update_vgname_and_id(cmd, info, &vgsummary)) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user