Updated the test case as per the man page

***********
RETURN VALUE
       If  name  is  invalid, -1 is returned, and errno is set to
EINVAL.  Otherwise, the value returned is the
       value of the system resource and errno is not changed.  In the
case of  options,  a  positive  value  is
       returned  if  a  queried option is available, and -1 if it is
not.  In the case of limits, -1 means that
       there is no definite limit.
***********

Return value of sysconf needs to be checked as well and not only depend
on errno value. Have made the changes by looking at the code from 

http://www.comptechdoc.org/os/linux/programming/c/linux_pgcpostest.html



-- 
Max Stirling <[EMAIL PROTECTED]>
--- sysconf01.c	2008-03-31 12:55:12.000000000 +0530
+++ sysconf01_new.c	2008-04-03 13:03:28.337870000 +0530
@@ -54,9 +54,10 @@ static void _test_sysconf(int name, cons
 	/* make sure we reset this as sysconf() will not */
 	errno = 0;
 	retval = sysconf(name);
-	if (errno != 0)
-		tst_resm(TFAIL, "sysconf(%s) failed, error=%d: %s\n",
-		         strname, errno, strerror(errno));
+	if((retval == -1) && (errno))
+		tst_resm(TWARN, "Bad option %s\n", strname);
+	else if((retval == -1) && (!errno))
+		tst_resm(TINFO, "%s NOT SUPPORTED\n", strname);
 	else
 		tst_resm(TPASS, "%s = %li", strname, retval);
 }
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to