[libvirt] [PATCH] virFork: placate static analyzers: ignore pthread_sigmask return value

Since we check all other uses of pthread_sigmask, be consistent and clear: mark that we're deliberately ignoring this one.
From 0cb4b2ffa51bb8c73243876221bff6d7edecd9cf Mon Sep 17 00:00:00 2001 From: Jim Meyering <meyering@redhat.com> Date: Fri, 19 Feb 2010 18:40:14 +0100 Subject: [PATCH] virFork: placate static analyzers: ignore pthread_sigmask return value
* src/util/util.c: Include "ignore-value.h". (virFork): We really do want to ignore pthread_sigmask failure. --- src/util/util.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/src/util/util.c b/src/util/util.c index 624e570..cf7bba5 100644 --- a/src/util/util.c +++ b/src/util/util.c @@ -69,6 +69,7 @@ #include "virterror_internal.h" #include "logging.h" #include "event.h" +#include "ignore-value.h" #include "buf.h" #include "util.h" #include "memory.h" @@ -344,7 +345,7 @@ int virFork(pid_t *pid) { if (*pid < 0) { /* attempt to restore signal mask, but ignore failure, to avoid obscuring the fork failure */ - pthread_sigmask(SIG_SETMASK, &oldmask, NULL); + ignore_value (pthread_sigmask(SIG_SETMASK, &oldmask, NULL)); virReportSystemError(saved_errno, "%s", _("cannot fork child process")); goto cleanup; -- 1.7.0.233.g05e1a

On 02/19/2010 12:41 PM, Jim Meyering wrote:
Since we check all other uses of pthread_sigmask, be consistent and clear: mark that we're deliberately ignoring this one.
Ah, right. I didn't think of that (and my compiler didn't complain. What target didn't I run / cflag didn't I set? I know you sent mail about it awhile back, but I'm not firing on enough cylinders right now to go looking for it ;-))
From 0cb4b2ffa51bb8c73243876221bff6d7edecd9cf Mon Sep 17 00:00:00 2001 From: Jim Meyering<meyering@redhat.com> Date: Fri, 19 Feb 2010 18:40:14 +0100 Subject: [PATCH] virFork: placate static analyzers: ignore pthread_sigmask return value
* src/util/util.c: Include "ignore-value.h". (virFork): We really do want to ignore pthread_sigmask failure. --- src/util/util.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/src/util/util.c b/src/util/util.c index 624e570..cf7bba5 100644 --- a/src/util/util.c +++ b/src/util/util.c @@ -69,6 +69,7 @@ #include "virterror_internal.h" #include "logging.h" #include "event.h" +#include "ignore-value.h" #include "buf.h" #include "util.h" #include "memory.h" @@ -344,7 +345,7 @@ int virFork(pid_t *pid) { if (*pid< 0) { /* attempt to restore signal mask, but ignore failure, to avoid obscuring the fork failure */ - pthread_sigmask(SIG_SETMASK,&oldmask, NULL); + ignore_value (pthread_sigmask(SIG_SETMASK,&oldmask, NULL)); virReportSystemError(saved_errno, "%s", _("cannot fork child process")); goto cleanup; -- 1.7.0.233.g05e1a
-- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
ACK (if I'm allowed ;-)

Laine Stump wrote:
On 02/19/2010 12:41 PM, Jim Meyering wrote:
Since we check all other uses of pthread_sigmask, be consistent and clear: mark that we're deliberately ignoring this one.
Ah, right. I didn't think of that (and my compiler didn't complain. What target didn't I run / cflag didn't I set? I know you sent mail about it awhile back, but I'm not firing on enough cylinders right now to go looking for it ;-))
That was reported by coverity. I don't know if clang could detect it. gcc currently doesn't do enough static analysis to notice that, but could be made to warn if we gave that function the warn_unused_result attribute. Though in this case, it's really not important. No harm in ignoring, since the only possible failure appears to be EINVAL, which you'd get for passing it an invalid arg. I wrote the patch solely to suppress the false-positive warning.
participants (2)
-
Jim Meyering
-
Laine Stump