From: Tim Wiederhake Date: Mon, 1 Feb 2021 12:42:01 +0000 (+0100) Subject: virsh-domain: Fix error handling of pthread_sigmask X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=4f5c22b27c7580a93d45e7475580b4dd55fd0da5;p=libvirt.git 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 Reviewed-by: Peter Krempa --- diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index 9746117bdb..fb8b4bdb72 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 */ @@ -10726,7 +10726,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 */