[glib/wip/smcv/mips-sigaction] cond test: Don't make assumptions about struct sigaction member order



commit 18ae2b3c78905a535bbfee26e9ed834a25f24c56
Author: Simon McVittie <smcv collabora com>
Date:   Tue Aug 13 08:41:09 2019 +0100

    cond test: Don't make assumptions about struct sigaction member order
    
    On x86 (and apparently most other Linux architectures), the union
    with the signal handler is the first member, but on MIPS Linux,
    the first struct member is sa_flags (possibly done to be compatible
    with IRIX). Zero out the struct and fill in the field we want by name.
    
    Signed-off-by: Simon McVittie <smcv collabora com>

 glib/tests/cond.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
---
diff --git a/glib/tests/cond.c b/glib/tests/cond.c
index 168064391..a48714961 100644
--- a/glib/tests/cond.c
+++ b/glib/tests/cond.c
@@ -316,8 +316,10 @@ test_wait_until_errno (void)
   gboolean result;
   GMutex lock;
   GCond cond;
+  struct sigaction act = { };
 
-  struct sigaction act = { { signal_handler, } }; /* important: no SA_RESTART (we want EINTR) */
+  /* important: no SA_RESTART (we want EINTR) */
+  act.sa_handler = signal_handler;
 
   g_test_summary ("Check proper handling of errno in g_cond_wait_until with a contended mutex");
   g_test_bug_base ("https://gitlab.gnome.org/GNOME/glib/";);


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