[Libreoffice-commits] core.git: sal/osl

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Tue Jan 15 20:48:42 UTC 2019


 sal/osl/unx/security.cxx |    9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

New commits:
commit d479d1694897bdb2588f38c4d231220efb4eb229
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Tue Jan 15 16:39:56 2019 +0100
Commit:     Stephan Bergmann <sbergman at redhat.com>
CommitDate: Tue Jan 15 21:48:19 2019 +0100

    simplify duplicate code
    
    Change-Id: Id3b2c0de16d2b6f7fd12dcdf6fc7354541ee0b61
    Reviewed-on: https://gerrit.libreoffice.org/66396
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/sal/osl/unx/security.cxx b/sal/osl/unx/security.cxx
index c440de1bf3e1..c2f355611eae 100644
--- a/sal/osl/unx/security.cxx
+++ b/sal/osl/unx/security.cxx
@@ -322,13 +322,12 @@ static bool osl_psz_getHomeDir(oslSecurity Security, sal_Char* pszDirectory, sal
 #endif
 
         if (pStr != nullptr && strlen(pStr) > 0 && access(pStr, 0) == 0)
+        {
             strncpy(pszDirectory, pStr, nMax);
-        else if (pSecImpl->m_pPasswd.pw_dir != nullptr)
-            strncpy(pszDirectory, pSecImpl->m_pPasswd.pw_dir, nMax);
-        else
-            return false;
+            return true;
+        }
     }
-    else if (pSecImpl->m_pPasswd.pw_dir != nullptr)
+    if (pSecImpl->m_pPasswd.pw_dir != nullptr)
         strncpy(pszDirectory, pSecImpl->m_pPasswd.pw_dir, nMax);
     else
         return false;


More information about the Libreoffice-commits mailing list