Openwall GNU/*/Linux - a small security-enhanced Linux distro for servers
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Tue, 16 Jun 2015 00:26:39 -0400
From: Rich Felker <dalias@...c.org>
To: musl@...ts.openwall.com
Subject: Re: [PATCH] Byte-based C locale, draft 2

On Sat, Jun 13, 2015 at 03:06:55AM -0400, Rich Felker wrote:
> diff --git a/src/multibyte/btowc.c b/src/multibyte/btowc.c
> index 9d2c3b1..8de060f 100644
> --- a/src/multibyte/btowc.c
> +++ b/src/multibyte/btowc.c
> @@ -1,7 +1,10 @@
> -#include <stdio.h>
>  #include <wchar.h>
> +#include <stdlib.h>
> +#include "internal.h"
>  
>  wint_t btowc(int c)
>  {
> -	return c<128U ? c : EOF;
> +	if (c < 128U) return c;
> +	if (MB_CUR_MAX==1) return CODEUNIT(c);
> +	return WEOF;
>  }

This was mildly buggy before the patch, and worse with it -- c==EOF
will no longer produce WEOF. Fixed the old bug and updating the patch.

Rich

Powered by blists - more mailing lists

Your e-mail address:

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.