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

Bug#187391: bug found (in libc)



On Sat, Apr 26, 2003 at 07:03:45PM -0400, Roland McGrath wrote:
> I don't know why you think there is a bug, but we don't plan to change the
> sockaddr format any time soon.  sa_len is not a bug.

no no please, i'm not asking for a change in sockaddr format. the former
discussion went really off-topic, and we discussed stuff that had not
much to do with the actual bug.

let me rephrase the problem. the following code:

	#include <sys/socket.h>
	#include <sys/un.h>
	main ()
	{
	  sockaddr_un test = { AF_LOCAL, "" };
	}

which might be arguably nice or crap code, complies with the sockaddr_un
definition, but it will only compile on GNU/Linux. on GNU it fails
with:

	$ g++ -c test.c -o /dev/null
	test.c: In function `int main()':
	test.c:6: invalid conversion from `const char*' to `unsigned char'

and the bug can be fixed without changing the definition, by just
applying this:

--- bits/sockaddr.h.old 2002-11-20 01:41:35.000000000 +0100
+++ bits/sockaddr.h     2003-04-26 14:52:38.000000000 +0200
@@ -33,7 +33,6 @@
    `struct sockaddr_in', `struct sockaddr_un', etc.  */
  
 #define        __SOCKADDR_COMMON(sa_prefix)    \
-  unsigned char sa_prefix##len;                \
   sa_family_t sa_prefix##family
  
 #define __SOCKADDR_COMMON_SIZE (2 * sizeof (unsigned char))


-- 
Robert Millan

make: *** No rule to make target `war'.  Stop.

Another world is possible - Just say no to genocide



Reply to: