qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [PATCH 12/16] [RFC] linux-user: fix sigismember() check


From: Miloš Stojanović
Subject: [Qemu-devel] [PATCH 12/16] [RFC] linux-user: fix sigismember() check
Date: Fri, 12 May 2017 13:02:20 +0200

Fix copying between the host and target signal sets for the case when the
target set is larger than the host set.

sigismember() returns 1 if the specified signal number is a member of
the specified signal set, but it can also return -1 if an error occurs
(e.g. an out of range signal number is specified). All non-zero values
would cause the signal to be added, so a comparison with 1 is added to
assure that only the signals which are really in the set get added to
the other set.

Signed-off-by: Miloš Stojanović <address@hidden>
---
 linux-user/signal.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/linux-user/signal.c b/linux-user/signal.c
index 59d70ec..d72caaf 100644
--- a/linux-user/signal.c
+++ b/linux-user/signal.c
@@ -149,7 +149,7 @@ static void host_to_target_sigset_internal(target_sigset_t 
*d,
     int i;
     target_sigemptyset(d);
     for (i = 1; i <= TARGET_NSIG; i++) {
-        if (sigismember(s, i)) {
+        if (sigismember(s, i) == 1) {
             target_sigaddset(d, host_to_target_signal(i));
         }
     }
@@ -171,7 +171,7 @@ static void target_to_host_sigset_internal(sigset_t *d,
     int i;
     sigemptyset(d);
     for (i = 1; i <= TARGET_NSIG; i++) {
-        if (target_sigismember(s, i)) {
+        if (target_sigismember(s, i) == 1) {
             sigaddset(d, target_to_host_signal(i));
         }
     }
-- 
1.9.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]