1 Star 0 Fork 71

Jiangjiacheng/src_libvirt

forked from src-openEuler/libvirt 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
virsh-domain-Fix-error-handling-of-pthread_sigmask.patch 1.91 KB
一键复制 编辑 原始数据 按行查看 历史
From 4e69b1be71fd431614aaf6d69208dabc4d7bf053 Mon Sep 17 00:00:00 2001
From: Tim Wiederhake <twiederh@redhat.com>
Date: Mon, 1 Feb 2021 13:42:01 +0100
Subject: [PATCH 086/108] virsh-domain: Fix error handling of pthread_sigmask
pthread_sigmask() returns 0 on success and "a non-zero value
on failure", but not neccessarily a negative one.
Found by clang-tidy's "bugprone-posix-return" check.
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
(cherry picked from commit 4f5c22b27c7580a93d45e7475580b4dd55fd0da5)
---
tools/virsh-domain.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index 622972bdd4..49b2ed3a3f 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -4238,7 +4238,7 @@ doSave(void *opaque)
sigemptyset(&sigmask);
sigaddset(&sigmask, SIGINT);
- if (pthread_sigmask(SIG_BLOCK, &sigmask, &oldsigmask) < 0)
+ if (pthread_sigmask(SIG_BLOCK, &sigmask, &oldsigmask) != 0)
goto out_sig;
#endif /* !WIN32 */
@@ -4768,7 +4768,7 @@ doManagedsave(void *opaque)
sigemptyset(&sigmask);
sigaddset(&sigmask, SIGINT);
- if (pthread_sigmask(SIG_BLOCK, &sigmask, &oldsigmask) < 0)
+ if (pthread_sigmask(SIG_BLOCK, &sigmask, &oldsigmask) != 0)
goto out_sig;
#endif /* !WIN32 */
@@ -5450,7 +5450,7 @@ doDump(void *opaque)
sigemptyset(&sigmask);
sigaddset(&sigmask, SIGINT);
- if (pthread_sigmask(SIG_BLOCK, &sigmask, &oldsigmask) < 0)
+ if (pthread_sigmask(SIG_BLOCK, &sigmask, &oldsigmask) != 0)
goto out_sig;
#endif /* !WIN32 */
@@ -10740,7 +10740,7 @@ doMigrate(void *opaque)
sigemptyset(&sigmask);
sigaddset(&sigmask, SIGINT);
- if (pthread_sigmask(SIG_BLOCK, &sigmask, &oldsigmask) < 0)
+ if (pthread_sigmask(SIG_BLOCK, &sigmask, &oldsigmask) != 0)
goto out_sig;
#endif /* !WIN32 */
--
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

搜索帮助