提交 d3b8a81a 编写于 作者: J Ján Tomko

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: NJán Tomko <jtomko@redhat.com>
上级 1efdab28
......@@ -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)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册