components/ksh93/patches/050-CR7065478.patch
changeset 4196 d697072a92f5
parent 789 5f074ca23733
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/ksh93/patches/050-CR7065478.patch	Mon Apr 27 10:19:50 2015 -0500
@@ -0,0 +1,46 @@
+--- a/src/lib/libast/comp/setlocale.c	Mon Dec 27 04:23:49 2010
++++ b/src/lib/libast/comp/setlocale.c	Fri Jul 22 00:30:31 2011
+@@ -19,6 +19,9 @@
+ *                   Phong Vo <[email protected]>                    *
+ *                                                                      *
+ ***********************************************************************/
++/*
++ * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
++ */
+ #pragma prototyped
+ 
+ /*
+@@ -2236,6 +2239,24 @@
+ 
+ typedef int (*Isw_f)(wchar_t);
+ 
++static int
++wide_wctomb(char* u, wchar_t w) 
++{
++	int size = 0;
++
++	if (u)
++	{
++		size = wctomb(u, w);
++		if (size < 0)
++		{
++			*u = (char)(w & 0xff);
++			size = 1;
++		}
++	}
++
++	return size;
++}
++
+ /*
+  * called when LC_CTYPE initialized or changes
+  */
+@@ -2280,7 +2301,7 @@
+ 	{
+ 		if (!(ast.mb_width = wcwidth))
+ 			ast.mb_width = default_wcwidth;
+-		ast.mb_conv = wctomb;
++		ast.mb_conv = wide_wctomb;
+ #ifdef mb_state
+ 		{
+ 			/*