return value if input byte is ASCII NUL.
+2010-04-06 Corinna Vinschen <corinna@vinschen.de>
+
+ * libc/stdlib/btowc.c (btowc): Reorganize EOF check. Fix incorrect
+ return value if input byte is ASCII NUL.
+
2010-04-01 Joel Sherrill <joel.sherrill@oarcorp.com>
* libc/include/sched.h: Include prototypes for
wchar_t pwc;
unsigned char b;
+ if (c == EOF)
+ return WEOF;
+
b = (unsigned char)c;
/* Put mbs in initial state. */
retval = __mbtowc (_REENT, &pwc, &b, 1, __locale_charset (), &mbs);
- if (c == EOF || retval != 1)
+ if (retval != 0 && retval != 1)
return WEOF;
- else
- return (wint_t)pwc;
+
+ return (wint_t)pwc;
}