diff options
author | olli <olli@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2011-03-11 12:12:40 +0000 |
---|---|---|
committer | olli <olli@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2011-03-11 12:12:40 +0000 |
commit | 8757d55d32fca9a07a3434ce8f53d2f6d7d54605 (patch) | |
tree | 0ebf07e7bc836df6cfca84368fda88c8ad14030d /ACE/tests/OS_Test.cpp | |
parent | 6560923ab7f2ab855eb5b1320d0b984d6d28c890 (diff) | |
download | ATCD-8757d55d32fca9a07a3434ce8f53d2f6d7d54605.tar.gz |
ChangeLogTag: Fri Mar 11 12:09:00 UTC 2011 Olli Savia <ops@iki.fi>
Diffstat (limited to 'ACE/tests/OS_Test.cpp')
-rw-r--r-- | ACE/tests/OS_Test.cpp | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/ACE/tests/OS_Test.cpp b/ACE/tests/OS_Test.cpp index 700d640b8c9..f77b042d454 100644 --- a/ACE/tests/OS_Test.cpp +++ b/ACE/tests/OS_Test.cpp @@ -648,6 +648,35 @@ snprintf_test (void) } static int +getpwnam_r_test (void) +{ + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Testing getpwnam_r\n"))); + + int result = 0; + + struct passwd pwd; + struct passwd *pwd_ptr; + char buf[1024]; + + if (ACE_OS::getpwnam_r (getlogin (), + &pwd, + buf, + sizeof (buf), + &pwd_ptr) != 0) + { + result = 1; + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("getpwnam_r() failed\n"))); + } + else + { + ACE_DEBUG ((LM_DEBUG, ACE_TEXT (" User '%s' has uid=%d and gid=%d\n"), + pwd_ptr->pw_name, pwd_ptr->pw_uid, pwd_ptr->pw_gid)); + } + + return result; +} + +static int ctime_r_test (void) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Testing ctime_r\n"))); @@ -1346,6 +1375,9 @@ run_main (int, ACE_TCHAR *[]) status = result; #endif /* !ACE_LACKS_VSNPRINTF || ACE_HAS_TRIO */ + if ((result = getpwnam_r_test ()) != 0) + status = result; + if ((result = ctime_r_test ()) != 0) status = result; |