Changeset 3912 for trunk


Ignore:
Timestamp:
Oct 24, 2014, 1:03:46 PM (11 years ago)
Author:
bird
Message:

trunk,0.6: Added check that the UNIXROOT_OUTSIDE env var is not set before checking whether we're inside the unixroot or not. This allowes a half chrooted setup, like if you first chroot($UNIXROOT) and chdired to it with a drive letter specified.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libc/src/kNIX/os2/fs-os2.c

    r3911 r3912  
    303303                __libc_gcchUnixRoot = cch;
    304304
    305                 ULONG ulDisk, ulIgnored;
    306                 rc = DosQueryCurrentDisk(&ulDisk, &ulIgnored);
    307                 if (   rc == NO_ERROR
    308                     && ulDisk + 'A' - 1 == __libc_gszUnixRoot[0])
     305                if (!getenv("UNIXROOT_OUTSIDE"))
    309306                {
    310                     if (cch == 3)
    311                         __libc_gfInUnixTree = 1;
    312                     else
     307                    ULONG ulDisk, ulIgnored;
     308                    rc = DosQueryCurrentDisk(&ulDisk, &ulIgnored);
     309                    if (   rc == NO_ERROR
     310                        && ulDisk + 'A' - 1 == __libc_gszUnixRoot[0])
    313311                    {
    314                         char szCurDir[PATH_MAX];
    315                         ULONG cbCurDir = sizeof(szCurDir);
    316                         rc = DosQueryCurrentDir(0, (PSZ)&szCurDir[0], &cbCurDir);
    317                         __libc_gfInUnixTree = rc == NO_ERROR
    318                                            && cch <= cbCurDir + 3
    319                                            && memicmp(&__libc_gszUnixRoot[3], szCurDir, cch - 3) == 0
    320                                            && (   cch == cbCurDir + 3
    321                                                || szCurDir[cch - 3] == '\\');
     312                        if (cch == 3)
     313                            __libc_gfInUnixTree = 1;
     314                        else
     315                        {
     316                            char szCurDir[PATH_MAX];
     317                            ULONG cbCurDir = sizeof(szCurDir);
     318                            rc = DosQueryCurrentDir(0, (PSZ)&szCurDir[0], &cbCurDir);
     319                            __libc_gfInUnixTree = rc == NO_ERROR
     320                                               && cch <= cbCurDir + 3
     321                                               && memicmp(&__libc_gszUnixRoot[3], szCurDir, cch - 3) == 0
     322                                               && (   cch == cbCurDir + 3
     323                                                   || szCurDir[cch - 3] == '\\');
     324                        }
     325
    322326                    }
    323 
    324327                }
    325328                LIBCLOG_MSG(__libc_gfInUnixTree ? "Inside unixroot chroot.\n" : "Outside unixroot chroot.\n");
Note: See TracChangeset for help on using the changeset viewer.