1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2025-03-03 10:15:45 +00:00

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 int
client_new_sock( const char * path ) client_new_sock( const char * path )
{ {
struct sockaddr_un sun; struct sockaddr_un sa;
int fd; int fd;
struct con * con; struct con * con;
@ -145,9 +145,9 @@ client_new_sock( const char * path )
gl_proxy = 0; gl_proxy = 0;
memset( &sun, 0, sizeof sun ); memset( &sa, 0, sizeof sa );
sun.sun_family = AF_LOCAL; sa.sun_family = AF_LOCAL;
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 ); fd = socket( AF_UNIX, SOCK_STREAM, 0 );
if( 0 > fd ) if( 0 > fd )
@ -156,7 +156,7 @@ client_new_sock( const char * path )
return -1; 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 ); errnomsg( "failed to connect to socket file: %s", path );
close( fd ); close( fd );

View file

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

View file

@ -195,18 +195,18 @@ readargs( int argc, char ** argv, char ** sockpath )
int int
makesock( enum confpathtype type, const char * path ) makesock( enum confpathtype type, const char * path )
{ {
struct sockaddr_un sun; struct sockaddr_un sa;
int fd; int fd;
memset( &sun, 0, sizeof sun ); memset( &sa, 0, sizeof sa );
sun.sun_family = AF_LOCAL; sa.sun_family = AF_LOCAL;
if( NULL == path ) 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 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 ); fd = socket( AF_UNIX, SOCK_STREAM, 0 );
@ -216,9 +216,9 @@ makesock( enum confpathtype type, const char * path )
return -1; 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 ); close( fd );
return -1; return -1;
} }

View file

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