Re: avoid compiler warning

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Jul 09, 2009 at 12:55:25PM +0000, Eric Blake wrote:
> ccache gcc -DHAVE_CONFIG_H -I. -I..  -include ../config.h -DBSD=1 -DSHELL
> -DIFS_BROKEN  -Wall -gdwarf-2 -Wall -Werror -MT mystring.o -MD -MP -MF
> .deps/mystring.Tpo -c -o mystring.o mystring.c
> miscbltin.c: In function `umaskcmd':
> miscbltin.c:201: warning: subscript has type `char'
> 
> isdigit is only defined over EOF and unsigned char values, so without this
> patch, you can trigger undefined behavior.

What compiler and what libc was this? isdigit is supposed to
be a function that takes an int argument according to POSIX.
If libc implements it as a macro then it's up to it to cast
the parameter to (int).

So I think you should fix this in your libc instead.

Thanks,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@xxxxxxxxxxxxxxxxxxx>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
--
To unsubscribe from this list: send the line "unsubscribe dash" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux