getopt.c: optarg should not be initialized

Eric Blake eblake@redhat.com
Tue Sep 21 23:52:00 GMT 2010


On 09/21/2010 10:11 AM, Christophe Lyon wrote:
> Well, then, why glibc doesn't initialize optarg?

I don't know.  We are free to copy that if we want, but POSIX does not 
require that we copy that.

>
> The problem I faced is that, being un-initialized in user code,

Why?  If your user code intends to override the libc getopt, then your 
user code must not use anything uninitialized.  Fix your user code - 
just because it happened to work with glibc does not make it correct.

-- 
Eric Blake   eblake@redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org



More information about the Newlib mailing list