[Exim] Exim+SGI+GCC (revisited)

Kezdőlap
Üzenet törlése
Válasz az üzenetre
Szerző: J T Breitner
Dátum:  
Címzett: exim-users
CC: 
Tárgy: [Exim] Exim+SGI+GCC (revisited)

Earlier, I posted about getting Exim on SGI/IRIX 6.2 machines to correctly return
the IP address. 

The problem is due to structure-passing inconsistencies between GCC and the
native libraries.  If you use the MipsPro compiler, this is not an issue.  If you're
unable to fork over the $2,000 for the native compiler and opt to use GCC, you have
this problem.

The bug produces IP address returns of 255.255.255.255, and the ramifications are
obvious.  

I had posted that a possible fix was to link in the bind8 library, since it has a
proper inet_ntoa function.  That isn't really necessary with this kludge.

To get around the inet_ntoa problem, paste this function above the random number
generator in host.c.

/* code by Stuart Levy */
/* as seen in comp.sys.sgi.admin */
/* Replacement for SGI libc inet_ntoa(), since
* gcc's structure-passing convention isn't the same as SGI cc's. */
char *inet_ntoa( struct in_addr sa )
{
  static char addr[20];
  sprintf(addr, "%d.%d.%d.%d",
        ((unsigned char *)&sa.s_addr)[0], ((unsigned char
*)&sa.s_addr)[1],
        ((unsigned char *)&sa.s_addr)[2], ((unsigned char
*)&sa.s_addr)[3]);
  return addr;
}

This should override the inet_ntoa() in libc on the SGI machine, and produce
proper IP address returns.

It would be spiffy if future releases of Exim could sense for IRIX and gcc and
switch that code in courtesy of a well-placed #ifdef.