svn commit: samba r2175 - in branches/SAMBA_3_0/source/lib: .
jra at samba.org
jra at samba.org
Wed Sep 1 17:39:30 GMT 2004
Author: jra
Date: 2004-09-01 17:39:27 +0000 (Wed, 01 Sep 2004)
New Revision: 2175
WebSVN: http://websvn.samba.org/websvn/changeset.php?rep=samba&path=/branches/SAMBA_3_0/source/lib&rev=2175&nolog=1
Log:
Fix for #1546 from fumiya at samba.gr.jp. Preserve errno in MB strupper_m/strlower_m.
Jeremy.
Modified:
branches/SAMBA_3_0/source/lib/util_str.c
Changeset:
Modified: branches/SAMBA_3_0/source/lib/util_str.c
===================================================================
--- branches/SAMBA_3_0/source/lib/util_str.c 2004-09-01 17:39:22 UTC (rev 2174)
+++ branches/SAMBA_3_0/source/lib/util_str.c 2004-09-01 17:39:27 UTC (rev 2175)
@@ -1391,6 +1391,7 @@
void strlower_m(char *s)
{
size_t len;
+ int errno_save;
/* this is quite a common operation, so we want it to be
fast. We optimise for the ascii case, knowing that all our
@@ -1408,11 +1409,13 @@
/* I assume that lowercased string takes the same number of bytes
* as source string even in UTF-8 encoding. (VIV) */
len = strlen(s) + 1;
+ errno_save = errno;
errno = 0;
unix_strlower(s,len,s,len);
/* Catch mb conversion errors that may not terminate. */
if (errno)
s[len-1] = '\0';
+ errno = errno_save;
}
/**
@@ -1422,6 +1425,7 @@
void strupper_m(char *s)
{
size_t len;
+ int errno_save;
/* this is quite a common operation, so we want it to be
fast. We optimise for the ascii case, knowing that all our
@@ -1439,11 +1443,13 @@
/* I assume that lowercased string takes the same number of bytes
* as source string even in multibyte encoding. (VIV) */
len = strlen(s) + 1;
+ errno_save = errno;
errno = 0;
unix_strupper(s,len,s,len);
/* Catch mb conversion errors that may not terminate. */
if (errno)
s[len-1] = '\0';
+ errno = errno_save;
}
/**
More information about the samba-cvs
mailing list