From: Mike F. <va...@us...> - 2009-08-28 13:03:12
|
Update of /cvsroot/ltp/ltp/testcases/kernel/syscalls/getgroups In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv12389 Modified Files: getgroups01.c Log Message: remove useless sprintf indirection Index: getgroups01.c =================================================================== RCS file: /cvsroot/ltp/ltp/testcases/kernel/syscalls/getgroups/getgroups01.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** getgroups01.c 23 Mar 2009 13:35:42 -0000 1.6 --- getgroups01.c 28 Aug 2009 13:03:01 -0000 1.7 *************** *** 111,115 **** int ret2; int errors = 0; - char msg[500]; /* Initialize the group access list */ --- 111,114 ---- *************** *** 142,162 **** if ((ret = TEST_RETURN) != -1) { ! sprintf(msg, ! "getgroups(-1,gidset) returned %d, expected -1 and errno = EINVAL", ! ret); ! tst_resm(TFAIL, msg); errors++; } else if (STD_FUNCTIONAL_TEST) { if (errno != EINVAL) { ! sprintf(msg, ! "getgroups(-1,gidset) returned %d, errno = %d, expected errno %d (EINVAL)", ret, errno, EINVAL); - tst_resm(TFAIL, msg); errors++; } else { ! sprintf(msg, "getgroups(-1,gidset) returned %d and error = %d (EINVAL) as expected", ret, errno); - tst_resm(TPASS, msg); } } --- 141,155 ---- if ((ret = TEST_RETURN) != -1) { ! tst_resm(TFAIL, "getgroups(-1,gidset) returned %d, expected -1 and errno = EINVAL", ret); errors++; } else if (STD_FUNCTIONAL_TEST) { if (errno != EINVAL) { ! tst_resm(TFAIL, "getgroups(-1,gidset) returned %d, errno = %d, expected errno %d (EINVAL)", ret, errno, EINVAL); errors++; } else { ! tst_resm(TPASS, "getgroups(-1,gidset) returned %d and error = %d (EINVAL) as expected", ret, errno); } } *************** *** 173,180 **** TEST(getgroups(0, gidset)); if ((ret = TEST_RETURN) < 0) { ! sprintf(msg, "getgroups(0,gidset) returned %d with errno = %d, expected num gids with no change to gidset", ret, errno); - tst_resm(TFAIL, msg); errors++; } else if (STD_FUNCTIONAL_TEST) { --- 166,172 ---- TEST(getgroups(0, gidset)); if ((ret = TEST_RETURN) < 0) { ! tst_resm(TFAIL, "getgroups(0,gidset) returned %d with errno = %d, expected num gids with no change to gidset", ret, errno); errors++; } else if (STD_FUNCTIONAL_TEST) { *************** *** 183,196 **** */ if (memcmp(cmpset, gidset, NGROUPS) != 0) { ! sprintf(msg, "getgroups(0,gidset) returned %d, the gidset array was modified", ret); - tst_resm(TFAIL, msg); errors++; } else { ! sprintf(msg, "getgroups(0,gidset) returned %d, the gidset array not was modified", ret); - tst_resm(TPASS, msg); } } --- 175,186 ---- */ if (memcmp(cmpset, gidset, NGROUPS) != 0) { ! tst_resm(TFAIL, "getgroups(0,gidset) returned %d, the gidset array was modified", ret); errors++; } else { ! tst_resm(TPASS, "getgroups(0,gidset) returned %d, the gidset array not was modified", ret); } } *************** *** 202,209 **** if (ret <= 1) { ! sprintf(msg, "getgroups(0,gidset) returned %d, Unable to test that\nusing ngrps >=1 but less than number of grps", ret); - tst_resm(TCONF, msg); errors++; } else { --- 192,198 ---- if (ret <= 1) { ! tst_resm(TCONF, "getgroups(0,gidset) returned %d, Unable to test that\nusing ngrps >=1 but less than number of grps", ret); errors++; } else { *************** *** 212,232 **** if (STD_FUNCTIONAL_TEST) { if (errno != EINVAL) { ! sprintf(msg, "getgroups(%d, gidset) returned -1, but not errno %d (EINVAL) but %d", ret - 1, EINVAL, errno); - tst_resm(TFAIL, msg); errors++; } else { ! sprintf(msg, "getgroups(%d, gidset) returned -1, and errno %d (EINVAL) when %d grps", ret - 1, errno, ret); - tst_resm(TPASS, msg); } } } else { ! sprintf(msg, "getgroups(%d, gidset) returned %d, expected -1 and errno EINVAL.", ret - 1, ret2); - tst_resm(TFAIL, msg); errors++; } --- 201,218 ---- if (STD_FUNCTIONAL_TEST) { if (errno != EINVAL) { ! tst_resm(TFAIL, "getgroups(%d, gidset) returned -1, but not errno %d (EINVAL) but %d", ret - 1, EINVAL, errno); errors++; } else { ! tst_resm(TPASS, "getgroups(%d, gidset) returned -1, and errno %d (EINVAL) when %d grps", ret - 1, errno, ret); } } } else { ! tst_resm(TFAIL, "getgroups(%d, gidset) returned %d, expected -1 and errno EINVAL.", ret - 1, ret2); errors++; } *************** *** 239,246 **** TEST(getgroups(NGROUPS, gidset)); if ((entries = TEST_RETURN) == -1) { ! sprintf(msg, "getgroups(NGROUPS,gidset) returned -1 and errno = %d", errno); - tst_resm(TFAIL, msg); errors++; } else if (STD_FUNCTIONAL_TEST) { --- 225,231 ---- TEST(getgroups(NGROUPS, gidset)); if ((entries = TEST_RETURN) == -1) { ! tst_resm(TFAIL, "getgroups(NGROUPS,gidset) returned -1 and errno = %d", errno); errors++; } else if (STD_FUNCTIONAL_TEST) { *************** *** 254,261 **** for (i = 0; i < entries; i++) { if (gidset[i] == group) { ! sprintf(msg, "getgroups(NGROUPS,gidset) ret %d contains gid %d (from getgid)", entries, group); - tst_resm(TPASS, msg); break; } --- 239,245 ---- for (i = 0; i < entries; i++) { if (gidset[i] == group) { ! tst_resm(TPASS, "getgroups(NGROUPS,gidset) ret %d contains gid %d (from getgid)", entries, group); break; } *************** *** 263,270 **** if (i == entries) { ! sprintf(msg, "getgroups(NGROUPS,gidset) ret %d, does not contain gid %d (from getgid)", entries, group); - tst_resm(TFAIL, msg); errors++; } --- 247,253 ---- if (i == entries) { ! tst_resm(TFAIL, "getgroups(NGROUPS,gidset) ret %d, does not contain gid %d (from getgid)", entries, group); errors++; } |