Apparently "sun" is a bad choice for a variable name on solaris.

This commit is contained in:
Josh Elsasser 2007-07-19 01:25:36 +00:00
parent 12f377fc6e
commit 4ab0a93807
4 changed files with 21 additions and 21 deletions

View File

@ -135,7 +135,7 @@ client_init( struct event_base * base )
int
client_new_sock( const char * path )
{
struct sockaddr_un sun;
struct sockaddr_un sa;
int fd;
struct con * con;
@ -145,9 +145,9 @@ client_new_sock( const char * path )
gl_proxy = 0;
memset( &sun, 0, sizeof sun );
sun.sun_family = AF_LOCAL;
strlcpy( sun.sun_path, path, sizeof sun.sun_path );
memset( &sa, 0, sizeof sa );
sa.sun_family = AF_LOCAL;
strlcpy( sa.sun_path, path, sizeof sa.sun_path );
fd = socket( AF_UNIX, SOCK_STREAM, 0 );
if( 0 > fd )
@ -156,7 +156,7 @@ client_new_sock( const char * path )
return -1;
}
if( 0 > connect( fd, ( struct sockaddr * )&sun, SUN_LEN( &sun ) ) )
if( 0 > connect( fd, ( struct sockaddr * )&sa, SUN_LEN( &sa ) ) )
{
errnomsg( "failed to connect to socket file: %s", path );
close( fd );

View File

@ -252,7 +252,7 @@ getlock( const char * path )
int
getsock( const char * path )
{
struct sockaddr_un sun;
struct sockaddr_un sa;
int fd;
fd = socket( PF_LOCAL, SOCK_STREAM, 0 );
@ -262,15 +262,15 @@ getsock( const char * path )
return -1;
}
memset( &sun, 0, sizeof sun );
sun.sun_family = AF_LOCAL;
strlcpy( sun.sun_path, path, sizeof sun.sun_path );
memset( &sa, 0, sizeof sa );
sa.sun_family = AF_LOCAL;
strlcpy( sa.sun_path, path, sizeof sa.sun_path );
unlink( path );
if( 0 > bind( fd, ( struct sockaddr * )&sun, SUN_LEN( &sun ) ) )
if( 0 > bind( fd, ( struct sockaddr * )&sa, SUN_LEN( &sa ) ) )
{
/* bind can sometimes fail on the first call */
unlink( path );
if( 0 > bind( fd, ( struct sockaddr * )&sun, SUN_LEN( &sun ) ) )
if( 0 > bind( fd, ( struct sockaddr * )&sa, SUN_LEN( &sa ) ) )
{
errnomsg( "failed to bind socket file: %s", path );
close( fd );

View File

@ -195,18 +195,18 @@ readargs( int argc, char ** argv, char ** sockpath )
int
makesock( enum confpathtype type, const char * path )
{
struct sockaddr_un sun;
struct sockaddr_un sa;
int fd;
memset( &sun, 0, sizeof sun );
sun.sun_family = AF_LOCAL;
memset( &sa, 0, sizeof sa );
sa.sun_family = AF_LOCAL;
if( NULL == path )
{
confpath( sun.sun_path, sizeof sun.sun_path, CONF_FILE_SOCKET, type );
confpath( sa.sun_path, sizeof sa.sun_path, CONF_FILE_SOCKET, type );
}
else
{
strlcpy( sun.sun_path, path, sizeof sun.sun_path );
strlcpy( sa.sun_path, path, sizeof sa.sun_path );
}
fd = socket( AF_UNIX, SOCK_STREAM, 0 );
@ -216,9 +216,9 @@ makesock( enum confpathtype type, const char * path )
return -1;
}
if( 0 > connect( fd, ( struct sockaddr * )&sun, SUN_LEN( &sun ) ) )
if( 0 > connect( fd, ( struct sockaddr * )&sa, SUN_LEN( &sa ) ) )
{
errnomsg( "failed to connect to socket file: %s", sun.sun_path );
errnomsg( "failed to connect to socket file: %s", sa.sun_path );
close( fd );
return -1;
}

View File

@ -188,7 +188,7 @@ server_listen( int fd )
void
newclient( int fd, short event UNUSED, void * arg )
{
struct sockaddr_un sun;
struct sockaddr_un sa;
struct client * client, * old;
socklen_t socklen;
struct bufferevent * clev;
@ -211,8 +211,8 @@ newclient( int fd, short event UNUSED, void * arg )
return;
}
socklen = sizeof sun;
clfd = accept( fd, ( struct sockaddr * )&sun, &socklen );
socklen = sizeof sa;
clfd = accept( fd, ( struct sockaddr * )&sa, &socklen );
if( 0 > clfd )
{
if( EWOULDBLOCK != errno && EAGAIN != errno &&