]> granicus.if.org Git - strace/commitdiff
tests/rt_sigpending.c: fix for systems where _NSIG > 16 * sizeof(long)
authorDmitry V. Levin <ldv@altlinux.org>
Wed, 20 Apr 2016 04:32:04 +0000 (04:32 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Wed, 20 Apr 2016 04:35:25 +0000 (04:35 +0000)
* tests/rt_sigsuspend.c (iterate): Do not assume that size will be less
than sizeof(long) on the second iteration.

tests/rt_sigsuspend.c

index 07a50e0863b901a0cbc663efd40e830bbe680125..b96a8c9b051eb32a5279e2ef406d213c3f904686 100644 (file)
@@ -48,11 +48,13 @@ k_sigsuspend(const sigset_t *const set, const unsigned long size)
 
 static void
 iterate(const char *const text, const int sig,
-       const void *set, unsigned int size)
+       const void *const set, unsigned int size)
 {
-       for (;;) {
+       const void *mask;
+
+       for (mask = set;; size >>= 1, mask += size) {
                raise(sig);
-               assert(k_sigsuspend(set, size) == -1);
+               assert(k_sigsuspend(mask, size) == -1);
                if (EINTR == errno) {
                        tprintf("rt_sigsuspend(%s, %u) = ? ERESTARTNOHAND"
                                " (To be restarted if no handler)\n",
@@ -61,16 +63,14 @@ iterate(const char *const text, const int sig,
                        if (size < sizeof(long))
                                tprintf("rt_sigsuspend(%p, %u)"
                                        " = -1 EINVAL (%m)\n",
-                                       set, size);
+                                       mask, size);
                        else
                                tprintf("rt_sigsuspend(%s, %u)"
                                        " = -1 EINVAL (%m)\n",
-                                       text, size);
+                                       set == mask ? text : "~[]", size);
                }
                if (!size)
                        break;
-               size >>= 1;
-               set += size;
        }
 }