public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Carmelo AMOROSO <carmelo.amoroso@st.com>
To: ltp-list@lists.sourceforge.net
Subject: Re: [LTP] [PATCH V2] clone06: set child_env to getenv directly
Date: Tue, 14 Feb 2012 12:24:07 +0100	[thread overview]
Message-ID: <4F3A4457.9070709@st.com> (raw)
In-Reply-To: <1329217994-11574-1-git-send-email-salvatore.cro@st.com>

On 14/02/2012 12.13, Salvatore CRO' wrote:
> sprintf check is bugged as a return value of 0 is acceptable.
> Furthermore sprintf to set the child env var is unneeded.
> Drop sprintf call as child_env can be set to getenv directly.
> 
> Signed-off-by: Salvatore Cro <salvatore.cro@st.com>

Acked-by: Carmelo Amoroso <carmelo.amoroso@st.com>

> ---
>  testcases/kernel/syscalls/clone/clone06.c |    8 +++-----
>  1 files changed, 3 insertions(+), 5 deletions(-)
> 
> diff --git a/testcases/kernel/syscalls/clone/clone06.c b/testcases/kernel/syscalls/clone/clone06.c
> index 5db183b..50c8ef3 100644
> --- a/testcases/kernel/syscalls/clone/clone06.c
> +++ b/testcases/kernel/syscalls/clone/clone06.c
> @@ -192,18 +192,16 @@ void cleanup()
>  int child_environ(void)
>  {
>  
> -	char var[MAX_LINE_LENGTH];
> +	char *child_env;
>  
>  	/* Close read end from child */
>  	if ((close(pfd[0])) == -1) {
>  		tst_brkm(TBROK|TERRNO, cleanup, "close(pfd[0]) failed");
>  	}
>  
> -	if ((sprintf(var, "%s", getenv("TERM") ? : "")) <= 0) {
> -		tst_resm(TWARN|TERRNO, "sprintf() failed");
> -	}
> +	child_env = getenv("TERM") ? : "";
>  
> -	if ((write(pfd[1], var, MAX_LINE_LENGTH)) == -1) {
> +	if ((write(pfd[1], child_env, MAX_LINE_LENGTH)) == -1) {
>  		tst_resm(TWARN|TERRNO, "write to pipe failed");
>  	}
>  


------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

  reply	other threads:[~2012-02-14 12:19 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-14 10:33 [LTP] [PATCH] clone06: legitimate zero as sprintf return value Salvatore CRO'
2012-02-14 11:03 ` [LTP] Fwd: " Salvatore CRO'
2012-02-14 11:13 ` [LTP] [PATCH V2] clone06: set child_env to getenv directly Salvatore CRO'
2012-02-14 11:24   ` Carmelo AMOROSO [this message]
2012-02-23 18:29   ` Cyril Hrubis
2012-02-23 18:30     ` Cyril Hrubis
     [not found]     ` <4F474AF7.1070901@st.com>
2012-02-29 16:47       ` Cyril Hrubis
2012-02-29 16:51 ` [LTP] [PATCH] clone06: legitimate zero as sprintf return value 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=4F3A4457.9070709@st.com \
    --to=carmelo.amoroso@st.com \
    --cc=ltp-list@lists.sourceforge.net \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox