All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bian Naimeng <biannm@cn.fujitsu.com>
To: Garrett Cooper <yanegomi@gmail.com>
Cc: ltp-list@lists.sourceforge.net
Subject: [LTP] [POSIX][PATCH]pthread_attr_t object should be initialized before using it
Date: Mon, 24 Jan 2011 17:28:36 +0800	[thread overview]
Message-ID: <4D3D4644.90607@cn.fujitsu.com> (raw)

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

             reply	other threads:[~2011-01-24  9:29 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-24  9:28 Bian Naimeng [this message]
2011-02-14 15:07 ` [LTP] [POSIX][PATCH]pthread_attr_t object should be initialized before using it Cyril Hrubis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4D3D4644.90607@cn.fujitsu.com \
    --to=biannm@cn.fujitsu.com \
    --cc=ltp-list@lists.sourceforge.net \
    --cc=yanegomi@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.