int main(int ac, char **av) { int lc; /* loop counter */ char *msg; /* message returned from parse_opts */ if ((msg = parse_opts(ac, av, NULL, NULL)) != NULL) tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); setup(); TEST_EXP_ENOS(exp_enos); for (lc = 0; TEST_LOOPING(lc); lc++) { Tst_count = 0; TEST(GETUID()); if (TEST_RETURN == -1) tst_resm(TFAIL|TTERRNO, "getuid failed"); else if (STD_FUNCTIONAL_TEST) tst_resm(TPASS, "getuid returned %ld", TEST_RETURN); } cleanup(); tst_exit(); }
int main(int ac, char **av) { struct passwd *pwent; int lc; /* loop counter */ char *msg; /* message returned by parse_opts */ if ((msg = parse_opts(ac, av, NULL, NULL)) != NULL) tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); setup(); for (lc = 0; TEST_LOOPING(lc); lc++) { Tst_count = 0; TEST(GETUID()); if (TEST_RETURN == -1) tst_brkm(TBROK|TTERRNO, cleanup, "getuid failed"); if (STD_FUNCTIONAL_TEST) { pwent = getpwuid(TEST_RETURN); if (pwent == NULL) tst_resm(TFAIL|TERRNO, "getpwuid failed"); else if (!UID_SIZE_CHECK(pwent->pw_uid)) tst_brkm(TBROK, cleanup, "uid = %ld is too large for testing " "getuid16", TEST_RETURN); else { if (pwent->pw_uid != TEST_RETURN) tst_resm(TFAIL, "getpwuid value, %d, " "does not match getuid " "value, %ld", pwent->pw_uid, TEST_RETURN); else tst_resm(TPASS, "values from getuid " "and getpwuid match"); } } else tst_resm(TPASS, "call succeeded"); } cleanup(); tst_exit(); }
int main(int ac, char **av) { struct passwd *pwent; int lc; uid_t uid; tst_parse_opts(ac, av, NULL, NULL); setup(); for (lc = 0; TEST_LOOPING(lc); lc++) { tst_count = 0; TEST(GETUID(cleanup)); if (TEST_RETURN == -1) tst_brkm(TBROK | TTERRNO, cleanup, "getuid failed"); uid = getuid(); pwent = getpwuid(uid); if (pwent == NULL) tst_resm(TFAIL | TERRNO, "getpwuid failed"); UID16_CHECK(pwent->pw_uid, getuid, cleanup); if (pwent->pw_uid != TEST_RETURN) tst_resm(TFAIL, "getpwuid value, %d, " "does not match getuid " "value, %ld", pwent->pw_uid, TEST_RETURN); else tst_resm(TPASS, "values from getuid " "and getpwuid match"); } cleanup(); tst_exit(); }
int main(int ac, char **av) { int lc; tst_parse_opts(ac, av, NULL, NULL); setup(); for (lc = 0; TEST_LOOPING(lc); lc++) { tst_count = 0; TEST(GETUID(cleanup)); if (TEST_RETURN == -1) tst_resm(TFAIL | TTERRNO, "getuid failed"); else tst_resm(TPASS, "getuid returned %ld", TEST_RETURN); } cleanup(); tst_exit(); }