diff --git a/daemon/client.c b/daemon/client.c index 7d558f526..3805e8f48 100644 --- a/daemon/client.c +++ b/daemon/client.c @@ -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 ); diff --git a/daemon/daemon.c b/daemon/daemon.c index 6862ee215..d5b01eaed 100644 --- a/daemon/daemon.c +++ b/daemon/daemon.c @@ -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 ); diff --git a/daemon/proxy.c b/daemon/proxy.c index 6bfa7e02b..bb675b2bc 100644 --- a/daemon/proxy.c +++ b/daemon/proxy.c @@ -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; } diff --git a/daemon/server.c b/daemon/server.c index 1969fa59d..9b90c14a8 100644 --- a/daemon/server.c +++ b/daemon/server.c @@ -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 &&