svn commit: r301069 - head/lib/libc/locale

Andrey A. Chernov ache at FreeBSD.org
Tue May 31 18:44:35 UTC 2016


Author: ache
Date: Tue May 31 18:44:33 2016
New Revision: 301069
URL: https://svnweb.freebsd.org/changeset/base/301069

Log:
  For EILSEQ case in mbsnrtowcs() and wcsnrtombs() update src to point to
  the character after the one this conversion stopped at.
  
  PR:     209907
  Submitted by: Roel Standaert <roel at abittechnical.com> (partially)
  MFC after:      3 days

Modified:
  head/lib/libc/locale/ascii.c
  head/lib/libc/locale/none.c

Modified: head/lib/libc/locale/ascii.c
==============================================================================
--- head/lib/libc/locale/ascii.c	Tue May 31 18:40:47 2016	(r301068)
+++ head/lib/libc/locale/ascii.c	Tue May 31 18:44:33 2016	(r301069)
@@ -143,6 +143,7 @@ _ascii_mbsnrtowcs(wchar_t * __restrict d
 	nchr = 0;
 	while (len-- > 0 && nms-- > 0) {
 		if (*s & 0x80) {
+			*src = s;
 			errno = EILSEQ;
 			return ((size_t)-1);
 		}
@@ -177,6 +178,7 @@ _ascii_wcsnrtombs(char * __restrict dst,
 	nchr = 0;
 	while (len-- > 0 && nwc-- > 0) {
 		if (*s < 0 || *s > 127) {
+			*src = s;
 			errno = EILSEQ;
 			return ((size_t)-1);
 		}

Modified: head/lib/libc/locale/none.c
==============================================================================
--- head/lib/libc/locale/none.c	Tue May 31 18:40:47 2016	(r301068)
+++ head/lib/libc/locale/none.c	Tue May 31 18:44:33 2016	(r301069)
@@ -174,6 +174,7 @@ _none_wcsnrtombs(char * __restrict dst, 
 	nchr = 0;
 	while (len-- > 0 && nwc-- > 0) {
 		if (*s < 0 || *s > UCHAR_MAX) {
+			*src = s;
 			errno = EILSEQ;
 			return ((size_t)-1);
 		}


More information about the svn-src-all mailing list