mirror of https://gitee.com/openkylin/libvirt.git
openvz: pass sizeof to snprintf
The size argument accounts for the nul-byte to terminate the string. Use sizeof and remove the pointless assignment. Signed-off-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
1efdab281f
commit
d3b8a81ae6
|
@ -1355,8 +1355,7 @@ static int openvzDomainSetVcpusInternal(virDomainObjPtr vm,
|
|||
if (pcpus > 0 && pcpus < nvcpus)
|
||||
nvcpus = pcpus;
|
||||
|
||||
snprintf(str_vcpus, 31, "%d", nvcpus);
|
||||
str_vcpus[31] = '\0';
|
||||
snprintf(str_vcpus, sizeof(str_vcpus), "%d", nvcpus);
|
||||
|
||||
openvzSetProgramSentinal(prog, vm->def->name);
|
||||
if (virRun(prog, NULL) < 0)
|
||||
|
|
Loading…
Reference in New Issue