bug-hurd
[Top][All Lists]
Advanced

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

Re: bug found (in libc)


From: Niels Möller
Subject: Re: bug found (in libc)
Date: 27 Apr 2003 15:55:25 +0200
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2

Robert Millan <zeratul2@wanadoo.es> writes:

> no no please, i'm not asking for a change in sockaddr format.

[...]

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

[...]

>  #define        __SOCKADDR_COMMON(sa_prefix)    \
> -  unsigned char sa_prefix##len;                \
>    sa_family_t sa_prefix##family

But that *is* precisely a change of the sockaddr format. struct
sockaddr (and sockaddr_un, sockaddr_in, etc) are defined in terms of
__SOCKADDR_COMMON. For example,

<bits/socket.h>:

  /* Structure describing a generic socket address.  */
  struct sockaddr
    {
      __SOCKADDR_COMMON (sa_);  /* Common data: address family and length.  */
      char sa_data[14];         /* Address data.  */
    };

<sys/un.h>:

  /* Structure describing the address of an AF_LOCAL (aka AF_UNIX)
  socket.  */
  struct sockaddr_un
    {
      __SOCKADDR_COMMON (sun_);
      char sun_path[108];               /* Path name.  */
    };
  
Changing __SOCKADDR_COMMON changes the definition of all sockaddr*.
That's what that macro is for.

/Niels




reply via email to

[Prev in Thread] Current Thread [Next in Thread]