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:55:14 +0200 |
commit | 241b8ef6e5145c9b4731c37ca62f013c82d06723 (patch) | |
tree | cd6d22a5c8404ce7c8df67a9cf83dde29b53d9d7 | |
parent | 6d1998a1e4ab2c1df914ba08445f95a750224144 (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.
Signed-off-by: Fridrich Štrba <fridrich.strba@bluewin.ch>
-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 e93714b92..93fa96ab2 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); |