summaryrefslogtreecommitdiff
path: root/sal
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@frugalware.org>2011-05-08 14:13:51 +0200
committerFridrich Štrba <fridrich.strba@bluewin.ch>2011-05-09 14:55:14 +0200
commitc8098382da6a7a0448ff8051cac467f91d7e0b36 (patch)
treedc6a8691cddf73504b965759c27f4915719a81c4 /sal
parent78c01c415bbf81d9e0fa0e767319f443e8387ff1 (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>
Diffstat (limited to 'sal')
-rw-r--r--sal/qa/osl/security/osl_Security.cxx5
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 0094ea388541..9025e8fd9b22 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);