To be honest I don't see any reason to have the sprintf at all.
I will refine my patch to directly evaluate string var to getenv...

-------- Original Message --------
Return-Path:    <[email protected]>
Received:       from localhost (lxmcdt5.ctn.st.com [164.130.129.175]) by 
mail7.sgp.st.com (MOS 4.3.3-GA) with ESMTP id ALM11201 (AUTH cros); Tue, 
14 Feb 2012 11:33:12 +0100
From:   Salvatore CRO' <[email protected]>
To:     [email protected]
Cc:     Salvatore Cro <[email protected]>
Subject:        [PATCH] clone06: legitimate zero as sprintf return value
Date:   Tue, 14 Feb 2012 11:33:01 +0100
Message-Id:     <[email protected]>
X-Mailer:       git-send-email 1.7.4.4



A return value of 0 for sprintf is acceptable as
it means zero byte read.
Indeed errno is not set in this case thus no warning
messages must be issued.

Signed-off-by: Salvatore Cro<[email protected]>
---
  testcases/kernel/syscalls/clone/clone06.c |    2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/testcases/kernel/syscalls/clone/clone06.c 
b/testcases/kernel/syscalls/clone/clone06.c
index 5db183b..8ba7c13 100644
--- a/testcases/kernel/syscalls/clone/clone06.c
+++ b/testcases/kernel/syscalls/clone/clone06.c
@@ -199,7 +199,7 @@ int child_environ(void)
                tst_brkm(TBROK|TERRNO, cleanup, "close(pfd[0]) failed");
        }

-       if ((sprintf(var, "%s", getenv("TERM") ? : ""))<= 0) {
+       if ((sprintf(var, "%s", getenv("TERM") ? : ""))<  0) {
                tst_resm(TWARN|TERRNO, "sprintf() failed");
        }

-- 
1.7.4.4



------------------------------------------------------------------------------
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