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

Bug#187391: bug found (in libc)



> 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.



Reply to: