From: "Stephen M. Webb" <[email protected]>

Code using xorg-gtest and compiling on 32-bit x86 targets using
GCC 4.7 or later get a truncation warning setting timeouts for
sigtimedwait().  If the code sets -Werror this is fatal.

This patch prevents those warnings.

Signed-off-by: Stephen M. Webb <[email protected]>
---
 src/process.cpp |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/process.cpp b/src/process.cpp
index 9580569..35831d7 100644
--- a/src/process.cpp
+++ b/src/process.cpp
@@ -152,8 +152,9 @@ bool xorg::testing::Process::WaitForExit(unsigned int 
timeout) {
   sigaddset(&sig_mask, SIGCHLD);
 
   if (sigprocmask(SIG_BLOCK, &sig_mask, &old_mask) == 0) {
-    struct timespec sig_timeout = {timeout / 1000,
-                                   (timeout % 1000) * 1000000L};
+    long tv_secs = timeout / 1000;
+    long tv_usecs = (timeout % 1000) * 1000000L;
+    struct timespec sig_timeout = { tv_secs, tv_usecs };
 
     if (sigtimedwait(&sig_mask, NULL, &sig_timeout) != SIGCHLD && errno != 
EAGAIN)
       usleep(timeout * 1000);
-- 
1.7.10.4

_______________________________________________
[email protected]: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to