summaryrefslogtreecommitdiffstats
path: root/lib/libc/locale/mblen.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libc/locale/mblen.c')
-rw-r--r--lib/libc/locale/mblen.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/libc/locale/mblen.c b/lib/libc/locale/mblen.c
index 2544ba8..b5b92d1 100644
--- a/lib/libc/locale/mblen.c
+++ b/lib/libc/locale/mblen.c
@@ -37,6 +37,7 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
+#include <errno.h>
#include <stdlib.h>
#include <stddef.h>
#include <rune.h>
@@ -51,7 +52,9 @@ mblen(s, n)
if (s == 0 || *s == 0)
return (0); /* No support for state dependent encodings. */
- if (sgetrune(s, n, &e) == _INVALID_RUNE)
+ if (sgetrune(s, n, &e) == _INVALID_RUNE) {
+ errno = EILSEQ;
return (s - e);
+ }
return (e - s);
}
OpenPOWER on IntegriCloud