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

Bug#187391: bug found (in libc)



At Sun, 27 Apr 2003 14:28:54 -0400 (EDT),
Roland McGrath wrote:
> > let me rephrase the problem. the following code:
> > 
> > 	#include <sys/socket.h>
> > 	#include <sys/un.h>
> > 	main ()
> > 	{
> > 	  sockaddr_un test = { AF_LOCAL, "" };
> > 	}
> 
> This code is wrong, i.e. not portable or POSIX-compliant.  You cannot use
> normal initializers for a structure that is part of a standard API, because
> in no such structure does the API specify the order of members, and in most
> such structures it's permissible to have additional members.  You can use
> an initializer if you use C99 labelled syntax, but what the code ought to
> do is not use an initializer.
> 
> > and the bug can be fixed without changing the definition, by just
> > applying this:
> 
> You seem to be confused.  That patch changes the definition of struct
> sockaddr_*, and not in a way that is compatible with anything else.

That's right.

BTW, Roland, could you plan to add sun_len into sockaddr_un on Hurd?
It's not senseless modification, I think.

Regards,
-- gotom



Reply to: