Index: /trunk/src/emx/ChangeLog.LIBC
===================================================================
--- /trunk/src/emx/ChangeLog.LIBC	(revision 2242)
+++ /trunk/src/emx/ChangeLog.LIBC	(revision 2243)
@@ -6,4 +6,8 @@
     - libc:
         o Replaced BSD regex with the new GLIBC implementation.
+        o Fixed two bad bugs in the handling of the list of free
+          SPM notification structures.
+        o Moved the codeset standardization up a bit so nl_langinfo
+          and setlocale reports the same codeset.
 
 2005-07-06: knut st. osmundsen <bird-gccos2-spam@anduin.net>
Index: /trunk/src/emx/src/lib/locale/setlocale.c
===================================================================
--- /trunk/src/emx/src/lib/locale/setlocale.c	(revision 2242)
+++ /trunk/src/emx/src/lib/locale/setlocale.c	(revision 2243)
@@ -535,19 +535,6 @@
      * Set codeset and query encoding.
      */
-    if (!strstr(pszCodeset,
-                "ibm-1208" "Ibm-1208" "IBm-1208" "IBM-1208" "IbM-1208" "iBm-1208" "iBM-1208" "ibM-1208"
-                "utf-8" "Utf-8" "UTf-8" "UTF-8" "UtF-8" "uTf-8" "uTF-8" "utF-8"
-                "utf8" "Utf8" "UTf8" "UTF8" "UtF8" "uTf8" "uTF8" "utF8"))
-        memcpy(pCtype->szCodeSet, "UTF-8", sizeof("UTF-8"));
-    else if (!strstr(pszCodeset,
-                     "ibm-1200" "Ibm-1200" "IBm-1200" "IBM-1200" "IbM-1200" "iBm-1200" "iBM-1200" "ibM-1200"
-                     "ucs-2" "Ucs-2" "UCs-2" "UCS-2" "UcS-2" "uCs-2" "uCS-2" "ucS-2"
-                     "ucs2" "Ucs2" "UCs2" "UCS2" "UcS2" "uCs2" "uCS2" "ucS2"))
-        memcpy(pCtype->szCodeSet, "UCS-2", sizeof("UCS-2"));
-    else
-    {
-        strncpy(pCtype->szCodeSet, pszCodeset, sizeof(pCtype->szCodeSet));
-        pCtype->szCodeSet[sizeof(pCtype->szCodeSet) - 1] = '\0';
-    }
+    strncpy(pCtype->szCodeSet, pszCodeset, sizeof(pCtype->szCodeSet));
+    pCtype->szCodeSet[sizeof(pCtype->szCodeSet) - 1] = '\0';
 
     uconv_attribute_t   attr;
@@ -1345,5 +1332,21 @@
         {
             if (pszCodepageActual)
+            {
                 Ucs2Sb(ucsCodepage, pszCodepageActual, UniStrlen(ucsCodepage) + 1);
+
+                /*
+                 * For some common codeset specs we'll normalize the naming.
+                 */
+                if (!strstr(pszCodepageActual,
+                            "ibm-1208" "Ibm-1208" "IBm-1208" "IBM-1208" "IbM-1208" "iBm-1208" "iBM-1208" "ibM-1208"
+                            "utf-8" "Utf-8" "UTf-8" "UTF-8" "UtF-8" "uTf-8" "uTF-8" "utF-8"
+                            "utf8" "Utf8" "UTf8" "UTF8" "UtF8" "uTf8" "uTF8" "utF8"))
+                    memcpy(pszCodepageActual, "UTF-8", sizeof("UTF-8"));
+                else if (!strstr(pszCodepageActual,
+                                 "ibm-1200" "Ibm-1200" "IBm-1200" "IBM-1200" "IbM-1200" "iBm-1200" "iBM-1200" "ibM-1200"
+                                 "ucs-2" "Ucs-2" "UCs-2" "UCS-2" "UcS-2" "uCs-2" "uCS-2" "ucS-2"
+                                 "ucs2" "Ucs2" "UCs2" "UCS2" "UcS2" "uCs2" "uCS2" "ucS2"))
+                    memcpy(pszCodepageActual, "UCS-2", sizeof("UCS-2"));
+            }
             LIBCLOG_RETURN_MSG(rc, "ret 0 *plobj=%08x *puobj=%08x pszCodepageActual=%p:{%s}\n",
                                (unsigned)*plobj, (unsigned)*puobj, pszCodepageActual, pszCodepageActual);
Index: /trunk/src/emx/src/lib/sys/sharedpm.c
===================================================================
--- /trunk/src/emx/src/lib/sys/sharedpm.c	(revision 2242)
+++ /trunk/src/emx/src/lib/sys/sharedpm.c	(revision 2243)
@@ -3051,4 +3051,7 @@
             LIBCLOG_RETURN_P(pNotify);
         }
+        /* next */
+        pPrev = pNotify;
+        pNotify = pNotify->pNext;
     }
 
@@ -3429,12 +3432,12 @@
          * Free up termination structures.
          */
-        __LIBC_PSPMCHILDNOTIFY pNotify;
-        for (pNotify = gpSPMHdr->pChildNotifyFreeHead; pNotify;)
+        while (gpSPMHdr->pChildNotifyFreeHead)
         {
             LIBCLOG_MSG("Reaping notification record %p (cb=%d pid=%#x iExitCode=%d enmDeathReason=%d)\n",
                         (void *)pNotify, pNotify->cb, pNotify->pid, pNotify->iExitCode, pNotify->enmDeathReason);
-            __LIBC_PSPMCHILDNOTIFY pFree = pNotify;
-            pNotify = pNotify->pNext;
+            __LIBC_PSPMCHILDNOTIFY pFree = gpSPMHdr->pChildNotifyFreeHead;
+            gpSPMHdr->pChildNotifyFreeHead = pFree->pNext;
             pFree->pNext = NULL;
+            pFree->enmDeathReason = __LIBC_EXIT_REASON_NONE;
             spmFree(pFree);
         }
