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 <[email protected]>

Acked-by: Carmelo Amoroso <[email protected]>

> ---
>  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
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to