提交 d6cfa0cd 编写于 作者: B Bobo Du 提交者: Michal Privoznik

util:Fix with process number and pid file do not match

the libvirtd pid file is not match the os process pid number
which is smaller than before.

this would be exist if the libvirtd process coredump or the os
process was killed which the next pid number is smaller.

you can be also edit the pid file to write the longer number than
before,then restart the libvirtd service.
Signed-off-by: NBobo Du <dubo163@126.com>
上级 0b5caa0d
......@@ -446,6 +446,14 @@ int virPidFileAcquirePath(const char *path,
snprintf(pidstr, sizeof(pidstr), "%lld", (long long) pid);
if (ftruncate(fd, 0) < 0) {
virReportSystemError(errno,
_("Failed to truncate pid file '%s'"),
path);
VIR_FORCE_CLOSE(fd);
return -1;
}
if (safewrite(fd, pidstr, strlen(pidstr)) < 0) {
virReportSystemError(errno,
_("Failed to write to pid file '%s'"),
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册