diff options
author | Rüdiger Timm <rt@openoffice.org> | 2004-01-07 15:25:35 +0000 |
---|---|---|
committer | Rüdiger Timm <rt@openoffice.org> | 2004-01-07 15:25:35 +0000 |
commit | e2b1cc9c723ff96a2d93157d00710555a19a8bc2 (patch) | |
tree | e344f3d7e9d92295e9cc131a4fb4d7f9f01ccd03 | |
parent | 20418cf05e0b046504ffb234583ce1a4e461f6f1 (diff) |
INTEGRATION: CWS geordi2q12 (1.8.14); FILE MERGED
2004/01/07 15:22:29 hr 1.8.14.1: #111934#: merge CWS sal7pp2 -> SRC680
-rw-r--r-- | sal/osl/unx/security.c | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/sal/osl/unx/security.c b/sal/osl/unx/security.c index 08e009bb1cae..8420ad781f71 100644 --- a/sal/osl/unx/security.c +++ b/sal/osl/unx/security.c @@ -2,9 +2,9 @@ * * $RCSfile: security.c,v $ * - * $Revision: 1.8 $ + * $Revision: 1.9 $ * - * last change: $Author: rt $ $Date: 2003-11-25 10:45:22 $ + * last change: $Author: rt $ $Date: 2004-01-07 16:25:35 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -958,9 +958,22 @@ sal_Bool SAL_CALL osl_psz_getHomeDir(oslSecurity Security, sal_Char* pszDirector /* if current user, check also environment for HOME */ if (getuid() == pSecImpl->m_pPasswd.pw_uid) { - sal_Char *pStr; + sal_Char *pStr = NULL; #ifdef SOLARIS - pStr = getpwuid(getuid())->pw_dir; + char buffer[8192]; + + struct passwd pwd; + struct passwd *ppwd; + +#ifdef _POSIX_PTHREAD_SEMANTICS + if ( 0 != getpwuid_r(getuid(), &pwd, buffer, sizeof(buffer), &ppwd ) ) + ppwd = NULL; +#else + ppwd = getpwuid_r(getuid(), &pwd, buffer, sizeof(buffer) ); +#endif + + if ( ppwd ) + pStr = ppwd->pw_dir; #else pStr = getenv("HOME"); #endif |