Revert "Patch [1/4] async-signal safe TLS."
[glibc.git] / iconvdata / bug-iconv8.c
blobb91dc1d1f2fb1fde9a06de9d293e484bc47f05ef
1 // BZ 12601
2 #include <stdio.h>
3 #include <errno.h>
4 #include <iconv.h>
6 static int
7 do_test (void)
9 iconv_t cd;
10 char in[] = "\x83\xd9";
11 char out[256];
12 char *inbuf;
13 size_t inbytesleft;
14 char *outbuf;
15 size_t outbytesleft;
16 size_t ret;
18 inbuf = in;
19 inbytesleft = sizeof(in) - 1;
20 outbuf = out;
21 outbytesleft = sizeof(out);
23 cd = iconv_open("utf-8", "cp932");
24 ret = iconv(cd, &inbuf, &inbytesleft, &outbuf, &outbytesleft);
25 iconv_close(cd);
27 printf("result: %zd %d %zd %d\n", ret, errno, inbytesleft, inbuf[0]);
30 * result: -1 84 0 0 (84=EILSEQ)
32 * Error is returnd but inbuf is consumed.
34 * \x83\xd9 is valid shift-jis sequence but no character is assigned
35 * to it.
38 return (ret != -1 || errno != EILSEQ
39 || inbytesleft != 2 || inbuf[0] != in[0]);
42 #define TEST_FUNCTION do_test ()
43 #include "../test-skeleton.c"