1 Star 0 Fork 71

Jiangjiacheng/src_libvirt

forked from src-openEuler/libvirt 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
leaseshelper-Report-errors-on-failure.patch 1.73 KB
一键复制 编辑 原始数据 按行查看 历史
From 75d4ed800f297532a7b3ac2b8f8a94c049959e3b Mon Sep 17 00:00:00 2001
From: Michal Privoznik <mprivozn@redhat.com>
Date: Fri, 18 Dec 2020 16:09:08 +0100
Subject: [PATCH 024/108] leaseshelper: Report errors on failure
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
If leasehelper fails all that we are left with is a simple error
message produced by dnsmasq:
lease-init script returned exit code 1
This is because the leasehelper did not write any message to
stderr. According to dnsmasq's manpage, whenever it's invoking
leasehelper the stderr is kept open:
All file descriptors are closed except stdin, which is open to
/dev/null, and stdout and stderr which capture output for
logging by dnsmasq.
As debugging leasehelper is not trivial (because dnsmasq invokes
it with plenty of env vars set - that's how data is passed onto
helper), let's print an error into stderr if exiting with an
error. And since we are not calling public APIs, we have to call
virDispatchError() explicitly and since we don't have any
connection open, we have to pass NULL.
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
(cherry picked from commit c14bd64f3eba9838af8ab1cac369d51abfeb21b9)
---
src/network/leaseshelper.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/network/leaseshelper.c b/src/network/leaseshelper.c
index 2b5fc0f442..fdd7fd3e80 100644
--- a/src/network/leaseshelper.c
+++ b/src/network/leaseshelper.c
@@ -253,6 +253,8 @@ main(int argc, char **argv)
rv = EXIT_SUCCESS;
cleanup:
+ if (rv != EXIT_SUCCESS)
+ virDispatchError(NULL);
if (pid_file_fd != -1)
virPidFileReleasePath(pid_file, pid_file_fd);
--
2.33.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/jjiacheng/src_libvirt.git
git@gitee.com:jjiacheng/src_libvirt.git
jjiacheng
src_libvirt
src_libvirt
master

搜索帮助