From 9ab746d8ac7bd04855709c72250794e014913bab Mon Sep 17 00:00:00 2001 From: ehouse Date: Tue, 28 Jul 2009 05:17:44 +0000 Subject: [PATCH] Include strerror output in a few socket-related error messages. --- xwords4/linux/linuxmain.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/xwords4/linux/linuxmain.c b/xwords4/linux/linuxmain.c index b5fee916b..c5d265b7d 100644 --- a/xwords4/linux/linuxmain.c +++ b/xwords4/linux/linuxmain.c @@ -502,7 +502,7 @@ linux_relay_receive( CommonGlobals* cGlobals, unsigned char* buf, int bufSize ) unsigned short packetSize; ssize_t nRead = recv( sock, &tmp, sizeof(tmp), 0 ); if ( nRead != 2 ) { - XP_LOGF( "recv => %d, errno=%d", nRead, errno ); + XP_LOGF( "recv => %d, errno=%d (\"%s\")", nRead, errno, strerror(errno) ); linux_close_socket( cGlobals ); comms_transportFailed( cGlobals->game.comms ); nRead = -1; @@ -512,7 +512,8 @@ linux_relay_receive( CommonGlobals* cGlobals, unsigned char* buf, int bufSize ) assert( packetSize <= bufSize ); nRead = recv( sock, buf, packetSize, 0 ); if ( nRead < 0 ) { - XP_WARNF( "linuxReceive: errno=%d\n", errno ); + XP_WARNF( "linuxReceive: errno=%d (\"%s\")\n", errno, + strerror(errno) ); } } return nRead; @@ -558,7 +559,8 @@ linux_util_makeStreamFromAddr( XW_UtilCtxt* uctx, XP_U16 channelNo ) newSocket ); /* #define EADDRINUSE 98 */ result = bind( newSocket, (struct sockaddr*)returnAddr, addrLen ); - fprintf( stderr, "bind returned %d; errno=%d\n", result, errno ); + fprintf( stderr, "bind returned %d; errno=%d (\"%s\")\n", result, errno, + strerror(errno) ); return linux_make_socketStream( newSocket ); #endif