1 Star 0 Fork 71

tzr/libvirt

forked from src-openEuler/libvirt 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
libvirt-util-virdaemon-fix-waiting-for-child-processes.patch 1.80 KB
一键复制 编辑 原始数据 按行查看 历史
From 66ee42dc1a3a1445fed97c000f949ae0455bf948 Mon Sep 17 00:00:00 2001
From: Rafael Fonseca <r4f4rfs@gmail.com>
Date: Tue, 21 Apr 2020 15:55:46 +0800
Subject: util: virdaemon: fix waiting for child processes
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Unlike `waitpid`, `virProcessWait` only returns -1 (error) or 0
(success), so comparing that to `pid` will always be false and the
parent will report failure with:
error : main:851 : Failed to fork as daemon: No such file or directory
even though the grandchild process is succesfully running. Note that the
errno message is misleading: it was last set when trying to find a
restart state file.
Signed-off-by: Rafael Fonseca <r4f4rfs@gmail.com>
Reported-by: Marcin Krol <hawk@tld-linux.org>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
(cherry-picked from commit a87e4788d2ee3d74cef5679d2961689d4e4a96a3)
Signed-off-by: Xu Yandong <xuyandong2@huawei.com>
---
src/util/virdaemon.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/src/util/virdaemon.c b/src/util/virdaemon.c
index 5d92c7d..99530fd 100644
--- a/src/util/virdaemon.c
+++ b/src/util/virdaemon.c
@@ -97,15 +97,14 @@ virDaemonForkIntoBackground(const char *argv0)
default:
{
/* parent */
- int got, exitstatus = 0;
+ int exitstatus = 0;
int ret;
char status;
VIR_FORCE_CLOSE(statuspipe[1]);
/* We wait to make sure the first child forked successfully */
- if ((got = virProcessWait(pid, &exitstatus, 0)) < 0 ||
- got != pid ||
+ if (virProcessWait(pid, &exitstatus, 0) < 0 ||
exitstatus != 0) {
goto error;
}
--
2.23.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/tom0392/libvirt.git
git@gitee.com:tom0392/libvirt.git
tom0392
libvirt
libvirt
master

搜索帮助