VirtualBox

Changeset 79561 in vbox for trunk/src/VBox/Runtime/r3/posix


Ignore:
Timestamp:
Jul 5, 2019 7:37:47 PM (6 years ago)
Author:
vboxsync
Message:

IPRT/process-creation-posix.cpp: Try to dynamically resolve crypt_r on linux. [fix] ticketref:18682

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/r3/posix/ldrNative-posix.cpp

    r79559 r79561  
    141141    Assert(strchr(pszFilename, '/') == NULL);
    142142
    143     /* Easy if suffix was included. */
     143    uint32_t const fFlags2 = fFlags & ~(RTLDRLOAD_FLAGS_SO_VER_BEGIN_MASK | RTLDRLOAD_FLAGS_SO_VER_END_MASK);
     144
     145    /*
     146     * If no suffix is given and we haven't got any RTLDRLOAD_FLAGS_SO_VER_ range to work
     147     * with, we can call RTLdrLoadEx directly.
     148     */
    144149    if (!pszExt)
    145         return RTLdrLoadEx(pszFilename, phLdrMod, fFlags, NULL);
     150    {
     151#if !defined(RT_OS_DARWIN) && !defined(RT_OS_OS2) && !defined(RT_OS_WINDOWS)
     152        if (    (fFlags & RTLDRLOAD_FLAGS_SO_VER_BEGIN_MASK) >> RTLDRLOAD_FLAGS_SO_VER_BEGIN_SHIFT
     153             == (fFlags & RTLDRLOAD_FLAGS_SO_VER_END_MASK)   >> RTLDRLOAD_FLAGS_SO_VER_END_SHIFT)
     154#endif
     155            return RTLdrLoadEx(pszFilename, phLdrMod, fFlags2, NULL);
     156        pszExt = "";
     157    }
    146158
    147     /* Combine filename and suffix and then do the loading. */
     159    /*
     160     * Combine filename and suffix and then do the loading.
     161     */
    148162    size_t const cchFilename = strlen(pszFilename);
    149163    size_t const cchSuffix   = strlen(pszExt);
     
    153167    pszTmp[cchFilename + cchSuffix] = '\0';
    154168
    155     int rc = RTLdrLoadEx(pszTmp, phLdrMod, fFlags, NULL);
     169    int rc = RTLdrLoadEx(pszTmp, phLdrMod, fFlags2, NULL);
    156170
    157171#if !defined(RT_OS_DARWIN) && !defined(RT_OS_OS2) && !defined(RT_OS_WINDOWS)
     
    165179        if (pszActualSuff && strcmp(pszActualSuff, ".so") == 0)
    166180        {
    167             uint32_t const uBegin = (fFlags & RTLDRLOAD_FLAGS_SO_VER_BEGIN_MASK) >> RTLDRLOAD_FLAGS_SO_VER_BEGIN_SHIFT;
    168             uint32_t const uEnd   = (fFlags & RTLDRLOAD_FLAGS_SO_VER_END_MASK)   >> RTLDRLOAD_FLAGS_SO_VER_END_SHIFT;
    169             int32_t const  iIncr  = uBegin <= uEnd ? 1 : -1;
    170             for (uint32_t uMajorVer = uBegin; uMajorVer != uEnd; uMajorVer += iIncr)
     181            int32_t const iBegin    = (fFlags & RTLDRLOAD_FLAGS_SO_VER_BEGIN_MASK) >> RTLDRLOAD_FLAGS_SO_VER_BEGIN_SHIFT;
     182            int32_t const iEnd      = (fFlags & RTLDRLOAD_FLAGS_SO_VER_END_MASK)   >> RTLDRLOAD_FLAGS_SO_VER_END_SHIFT;
     183            int32_t const iIncr     = iBegin <= iEnd ? 1 : -1;
     184            for (int32_t  iMajorVer = iBegin; iMajorVer != iEnd; iMajorVer += iIncr)
    171185            {
    172                 RTStrPrintf(&pszTmp[cchFilename + cchSuffix], 16 + 1, ".%u", uMajorVer);
    173                 rc = RTLdrLoadEx(pszTmp, phLdrMod, fFlags, NULL);
     186                RTStrPrintf(&pszTmp[cchFilename + cchSuffix], 16 + 1, ".%d", iMajorVer);
     187                rc = RTLdrLoadEx(pszTmp, phLdrMod, fFlags2, NULL);
    174188                if (RT_SUCCESS(rc))
    175189                    break;
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette