[libvirt PATCH 04/11] virsh-domain: Fix error handling of pthread_sigmask

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
 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 2bb136333f..298c3a6587 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -4226,7 +4226,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 */
 
@@ -4756,7 +4756,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 */
 
@@ -5438,7 +5438,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 */
 
@@ -10732,7 +10732,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.26.2




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux