From 06a107f1160bcf212eb2813e573dde52b6ed5f3c Mon Sep 17 00:00:00 2001 From: Ron Pedde Date: Fri, 7 Sep 2007 06:52:23 +0000 Subject: [PATCH] Add debugging to try and find problems with EBADF on Sun Cobalt RaQ --- src/io.c | 4 ++++ src/webserver.c | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/io.c b/src/io.c index eefee774..243598cb 100644 --- a/src/io.c +++ b/src/io.c @@ -2171,6 +2171,8 @@ int io_listen_accept(IO_PRIVHANDLE *phandle, IO_PRIVHANDLE *pchild, return FALSE; } + io_err_printf(IO_LOG_DEBUG,"Got listen socket %d\n",child_fd); + /* copy host, if passed a buffer */ if(host) *host = client.sin_addr; @@ -2290,6 +2292,8 @@ int io_socket_write(IO_PRIVHANDLE *phandle, unsigned char *buf,uint32_t *len) { return FALSE; } + io_err_printf(IO_LOG_DEBUG,"writing to socket %d\n",priv->fd); + for(bufp = buf, bytestowrite = *len, totalbytes=0; bytestowrite > 0; bufp += byteswritten, bytestowrite -= byteswritten) { diff --git a/src/webserver.c b/src/webserver.c index 87fd350d..eb06f740 100644 --- a/src/webserver.c +++ b/src/webserver.c @@ -1189,12 +1189,12 @@ int ws_writefd(WS_CONNINFO *pwsc, char *fmt, ...) { WS_ENTER(); va_start(ap, fmt); - vsnprintf(buffer, 1024, fmt, ap); + vsnprintf(buffer, sizeof(buffer), fmt, ap); va_end(ap); len = (uint32_t)strlen(buffer); if(!io_write(pwsc->hclient,(unsigned char *)buffer,&len)) { - ws_dprintf(L_WS_LOG,"Error writing to client socket: %s", + ws_dprintf(L_WS_LOG,"Error writing to client socket: %s\n", io_errstr(pwsc->hclient)); } @@ -1216,7 +1216,7 @@ int ws_writebinary(WS_CONNINFO *pwsc, char *data, int len) { WS_ENTER(); bytes_written = (uint32_t) len; if(!io_write(pwsc->hclient, (unsigned char *)data, &bytes_written)) { - ws_dprintf(L_WS_LOG,"Error writing to client socket: %s", + ws_dprintf(L_WS_LOG,"Error writing to client socket: %s\n", io_errstr(pwsc->hclient)); }