[PATCH xorg-gtest 3/3] silenced truncation warnings on i386 targets
Stephen M. Webb
stephen.webb at canonical.com
Wed Jan 30 17:39:11 PST 2013
From: "Stephen M. Webb" <stephen.webb at canonical.com>
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 <stephen.webb at canonical.com>
---
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
More information about the xorg-devel
mailing list