include result of strerror in messages logging errno

This commit is contained in:
ehouse 2007-02-03 21:35:07 +00:00
parent 49d0d2b8f8
commit d5511d2ab3
2 changed files with 7 additions and 7 deletions

View file

@ -236,7 +236,7 @@ XWThreadPool::interrupt_poll()
unsigned char byt = 0;
int nSent = write( m_pipeWrite, &byt, 1 );
if ( nSent != 1 ) {
logf( XW_LOGERROR, "errno = %d", errno );
logf( XW_LOGERROR, "errno = %s (%d)", strerror(errno), errno );
}
}
@ -282,7 +282,7 @@ XWThreadPool::real_listener()
if ( nEvents == 0 ) {
tmgr->FireElapsedTimers();
} else if ( nEvents < 0 ) {
logf( XW_LOGERROR, "errno: %d", errno );
logf( XW_LOGERROR, "errno: %s (%d)", strerror(errno), errno );
}
if ( fds[0].revents != 0 ) {

View file

@ -384,16 +384,16 @@ make_socket( unsigned long addr, unsigned short port )
int result = bind( sock, (struct sockaddr*)&sockAddr, sizeof(sockAddr) );
if ( result != 0 ) {
logf( XW_LOGERROR, "exiting: unable to bind port %d: %d, errno = %d\n",
port, result, errno );
logf( XW_LOGERROR, "exiting: unable to bind port %d: %d, "
"errno = %s (%d)\n", port, result, strerror(errno), errno );
return -1;
}
logf( XW_LOGINFO, "bound socket %d on port %d", sock, port );
result = listen( sock, 5 );
if ( result != 0 ) {
logf( XW_LOGERROR, "exiting: unable to listen: %d, errno = %d\n",
result, errno );
logf( XW_LOGERROR, "exiting: unable to listen: %d, "
"errno = %s (%d)\n", result, strerror(errno), errno );
return -1;
}
return sock;
@ -589,7 +589,7 @@ int main( int argc, char** argv )
int retval = select( highest, &rfds, NULL, NULL, NULL );
if ( retval < 0 ) {
if ( errno != 4 ) { /* 4's what we get when signal interrupts */
logf( XW_LOGINFO, "errno: %d", errno );
logf( XW_LOGINFO, "errno: %s (%d)", strerror(errno), errno );
}
} else {
if ( FD_ISSET( g_listener, &rfds ) ) {