diff options
author | Miklos Vajna <vmiklos@frugalware.org> | 2011-05-08 14:13:51 +0200 |
---|---|---|
committer | Fridrich Štrba <fridrich.strba@bluewin.ch> | 2011-05-09 14:53:38 +0200 |
commit | 019ef9afbba38300f7cad522b1aa5e53ffed914a (patch) | |
tree | 684c166ec75660529ab5ed45d75d173ccf37f16c /sal | |
parent | 6a348d134a02defdbef123463741ea0f204d5ea5 (diff) |
Fix osl_Security::getHomeDir test under fakeroot
fakeroot uses LD_PRELOAD to let getuid() return 0, so getpwuid() will
not return the correct home directory. If we are under fakeroot, the
HOME environment variable can be used to do so.
Diffstat (limited to 'sal')
-rw-r--r-- | sal/qa/osl/security/osl_Security.cxx | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/sal/qa/osl/security/osl_Security.cxx b/sal/qa/osl/security/osl_Security.cxx index b454e004d032..d1023089c360 100644 --- a/sal/qa/osl/security/osl_Security.cxx +++ b/sal/qa/osl/security/osl_Security.cxx @@ -393,8 +393,11 @@ void MyTestPlugInImpl::initialize( CPPUNIT_NS::TestFactoryRegistry *, strUserName = ::rtl::OUString::createFromAscii( pw->pw_name ); /// get home directory; + char *pw_dir = pw->pw_dir; + if( getenv( "FAKEROOTKEY" ) ) + pw_dir = getenv("HOME"); CPPUNIT_ASSERT_MESSAGE( "#Convert from system path to URL failed.", - ::osl::File::E_None == ::osl::File::getFileURLFromSystemPath( ::rtl::OUString::createFromAscii( pw->pw_dir ), strHomeDirectory ) ); + ::osl::File::E_None == ::osl::File::getFileURLFromSystemPath( ::rtl::OUString::createFromAscii( pw_dir ), strHomeDirectory ) ); /// get config directory; strConfigDirectory = strHomeDirectory.copy(0); |