Index: trunk/libc/src/kNIX/b_initterm.c
===================================================================
--- trunk/libc/src/kNIX/b_initterm.c	(revision 3694)
+++ trunk/libc/src/kNIX/b_initterm.c	(revision 3696)
@@ -74,37 +74,44 @@
              */
 
-
-            if (!rc)
-                rc = __libc_back_fsInit();
             if (!rc)
             {
                 /*
-                 * Init file handles.
+                 * Setup environment (org_environ and _STD(environ)) before 
+                 * fsInit and other uses them.
                  */
-                rc = __libc_fhInit();
+                rc = __libc_back_envInit();
                 if (!rc)
                 {
-                    /*
-                     * Init signals
+                    /* 
+                     * Initialize the file system bits.
                      */
-                    rc = __libc_back_signalInit();
+                    rc = __libc_back_fsInit();
                     if (!rc)
                     {
                         /*
-                         * Setup environment (org_environ and _STD(environ))
+                         * Init file handles.
                          */
-                        rc = __libc_back_envInit();
+                        rc = __libc_fhInit();
                         if (!rc)
                         {
-                            /* more? */
-                            LIBCLOG_RETURN_INT(0);
+                            /*
+                             * Init signals
+                             */
+                            rc = __libc_back_signalInit();
+                            if (!rc)
+                            {
+                                /* more? */
+                                LIBCLOG_RETURN_INT(0);
+                                //__libc_back_signalTerm();
+                            }
+
+                            //__libc_fhTerm();
                         }
-                        //__libc_back_signalTerm();
+
+                        //__libc_back_fsTerm();
                     }
 
-                    //__libc_fhTerm();
+                    //__libc_back_envTerm();
                 }
-
-                //__libc_back_fsTerm();
             }
             __libc_back_termOS(hmod, pvOS, fFlags);
Index: trunk/libc/src/kNIX/os2/fs-os2.c
===================================================================
--- trunk/libc/src/kNIX/os2/fs-os2.c	(revision 3694)
+++ trunk/libc/src/kNIX/os2/fs-os2.c	(revision 3696)
@@ -194,4 +194,9 @@
 static _fmutex        g_mtxFSInfoVolumes = _FMUTEX_INITIALIZER_EX(_FMC_MUST_COMPLETE, "mtxFSInfoVolumes");
 
+/** Array of Unix EA settings overrides for all possible OS/2 volumes.
+ * Tristate: -1 force off, 0 default, 1 force on.
+ */
+static char           g_achUnixEAsOverrides['Z' - 'A' + 1];
+
 
 /*******************************************************************************
@@ -211,4 +216,5 @@
 {
     LIBCLOG_ENTER("\n");
+/** @todo getenv doesn't work at this point. :( */
 
     /*
@@ -298,5 +304,5 @@
     else
     {
-        LIBC_ASSERTM_FAILED("DosQueryModuleName(exe) failed: hmte=%lx rc=%d\n", pPib->pib_hmte, rc);
+        LIBC_ASSERTM_FAILED("DosQueryModuleName(exe) failed: hmte=%lx rc=%i\n", pPib->pib_hmte, (int)rc);
         gaMiscRewriteRules[0].cchTo = 1;
         gaMiscRewriteRules[0].pszTo = "/";
@@ -380,4 +386,73 @@
     }
     DosFreeModule(hmod);
+
+    /*
+     * Look for the UNIX EAs control environment variable.
+     * The value form: !a, c, !d-e
+     */
+    const char *pszUnixEAs = getenv("LIBC_UNIX_EAS");
+    if (pszUnixEAs)
+    {
+        while (*pszUnixEAs)
+        {
+            char chDrv;
+            while ((chDrv = *pszUnixEAs) == ',' || chDrv == ';' || chDrv == ' ' || chDrv == '\t')
+                pszUnixEAs++;
+            if (!chDrv)
+                break;
+
+            /* check for the operator. */
+            int fOverride = 1;
+            if (chDrv == '!')
+            {
+                fOverride = -1;
+                chDrv = *++pszUnixEAs;
+            }
+
+            /* check for the first drive letter, upper case it. */
+            if (chDrv >= 'a' && chDrv <= 'z')
+                chDrv -= 'a' - 'A';
+            if (chDrv < 'A' || chDrv > 'Z')
+                LIBCLOG_ERROR_RETURN_MSG(-1, "Bad LIBC_UNIX_EAS value; ch=%c\n", chDrv);
+            pszUnixEAs++;
+            if (*pszUnixEAs == ':')
+                pszUnixEAs++;
+
+            /* check if it is a range spec. */
+            char chDrv2;
+            while ((chDrv2 = *pszUnixEAs) == ' ' || chDrv2 == '\t')
+                pszUnixEAs++;
+            if (chDrv2 == '-')
+            {
+                pszUnixEAs++;
+                while ((chDrv2 = *pszUnixEAs) == ' ' || chDrv2 == '\t')
+                    pszUnixEAs++;
+
+                if (chDrv >= 'a' && chDrv <= 'z')
+                    chDrv -= 'a' - 'A';
+                if (chDrv < 'A' || chDrv > 'Z')
+                    LIBCLOG_ERROR_RETURN_MSG(-1, "Bad LIBC_UNIX_EAS value; ch=%c\n", chDrv2);
+                pszUnixEAs++;
+                if (*pszUnixEAs == ':')
+                    pszUnixEAs++;
+            }
+            else
+                chDrv2 = chDrv;
+
+            /* Be nice and swap the values if they are not in ascending order. */
+            if (chDrv2 < chDrv)
+            {
+                char chDrvTmp = chDrv2;
+                chDrv2 = chDrv;
+                chDrv = chDrvTmp;
+            }
+
+            /* apply them. */
+            do
+                g_achUnixEAsOverrides[chDrv - 'A'] = fOverride;
+            while (chDrv++ < chDrv2);
+        }
+    }
+
     LIBCLOG_RETURN_INT(0);
 }
@@ -525,4 +600,8 @@
     /*else if (!strcmp(pFsInfo->szName, "FAT32"))
     { } */
+
+    /* check the Unix EAs overrides. */
+    if (g_achUnixEAsOverrides[minor(Dev) - 'A'] != 0)
+        pFsInfo->fUnixEAs = g_achUnixEAsOverrides[minor(Dev) - 'A'] > 0;
 
     LIBCLOG_MSG2("fsInfoObjUpdate: dev:%#x mp:%s fsd:%s fZeroNewBytes=%d fUnixEAs=%d\n",
