[prev in list] [next in list] [prev in thread] [next in thread] 

List:       ltp-list
Subject:    [LTP] [POSIX][PATCH]pthread_attr_t object should be initialized
From:       Bian Naimeng <biannm () cn ! fujitsu ! com>
Date:       2011-01-24 9:28:36
Message-ID: 4D3D4644.90607 () cn ! fujitsu ! com
[Download RAW message or body]

pthread_attr_t object should be initialized before using it.

Signed-off-by: Bian Naimeng <biannm@cn.fujitsu.com>

---
 .../interfaces/pthread_attr_setstacksize/2-1.c     |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setstacksize/2-1.c \
b/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setstacksize/2-1.c
 index 92fb33a..bf2ebc2 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setstacksize/2-1.c
                
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setstacksize/2-1.c
 @@ -41,14 +41,14 @@ void *thread_func()
 	size_t ssize;
 	int rc;
 
-	if ((rc = pthread_getattr_np(pthread_self(), &attr)) != 0) {
-		printf(ERROR_PREFIX "pthread_getattr_np: %s\n", strerror(rc));
-		exit(PTS_FAIL);
-	}
 	if ((rc = pthread_attr_init(&attr)) != 0) {
 		printf(ERROR_PREFIX "pthread_attr_init: %s\n", strerror(rc));
 		exit(PTS_FAIL);
 	}
+	if ((rc = pthread_getattr_np(pthread_self(), &attr)) != 0) {
+		printf(ERROR_PREFIX "pthread_getattr_np: %s\n", strerror(rc));
+		exit(PTS_FAIL);
+	}
 	if ((rc = pthread_attr_getstacksize(&attr, &ssize)) != 0) {
 		printf(ERROR_PREFIX "pthread_attr_getstacksize: %s\n",
 			strerror(rc));
@@ -127,4 +127,4 @@ int main()
 
 	printf("Test PASSED\n");
 	return PTS_PASS;
-}
\ No newline at end of file
+}
-- 
1.7.0.4



-- 
Regards
Bian Naimeng


------------------------------------------------------------------------------
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires 
February 28th, so secure your free ArcSight Logger TODAY! 
http://p.sf.net/sfu/arcsight-sfd2d
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic