Changeset 3912 for branches/libc-0.6/src


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
  • branches/libc-0.6/src/emx/src/lib/sys/fs.c

    r3911 r3912  
    355355                    __libc_gcchUnixRoot = cch;
    356356
    357                     ULONG ulDisk, ulIgnored;
    358                     rc = DosQueryCurrentDisk(&ulDisk, &ulIgnored);
    359                     if (   rc == NO_ERROR
    360                         && ulDisk + 'A' - 1 == __libc_gszUnixRoot[0])
     357                    if (!getenv("UNIXROOT_OUTSIDE"))
    361358                    {
    362                         if (cch == 3)
    363                             __libc_gfInUnixTree = 1;
    364                         else
     359                        ULONG ulDisk, ulIgnored;
     360                        rc = DosQueryCurrentDisk(&ulDisk, &ulIgnored);
     361                        if (   rc == NO_ERROR
     362                            && ulDisk + 'A' - 1 == __libc_gszUnixRoot[0])
    365363                        {
    366                             char szCurDir[PATH_MAX];
    367                             ULONG cbCurDir = sizeof(szCurDir);
    368                             rc = DosQueryCurrentDir(0, (PSZ)&szCurDir[0], &cbCurDir);
    369                             __libc_gfInUnixTree = rc == NO_ERROR
    370                                                && cch <= cbCurDir + 3
    371                                                && memicmp(&__libc_gszUnixRoot[3], szCurDir, cch - 3) == 0
    372                                                && (   cch == cbCurDir + 3
    373                                                    || szCurDir[cch - 3] == '\\');
     364                            if (cch == 3)
     365                                __libc_gfInUnixTree = 1;
     366                            else
     367                            {
     368                                char szCurDir[PATH_MAX];
     369                                ULONG cbCurDir = sizeof(szCurDir);
     370                                rc = DosQueryCurrentDir(0, (PSZ)&szCurDir[0], &cbCurDir);
     371                                __libc_gfInUnixTree = rc == NO_ERROR
     372                                                   && cch <= cbCurDir + 3
     373                                                   && memicmp(&__libc_gszUnixRoot[3], szCurDir, cch - 3) == 0
     374                                                   && (   cch == cbCurDir + 3
     375                                                       || szCurDir[cch - 3] == '\\');
     376                            }
     377
    374378                        }
    375 
    376379                    }
    377380                    LIBCLOG_MSG(__libc_gfInUnixTree ? "Inside unixroot chroot.\n" : "Outside unixroot chroot.\n");
Note: See TracChangeset for help on using the changeset viewer.