From 1244e654b243695367e70e847b74dac09f6fcee6 Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Mon, 30 Dec 1996 22:30:58 +0000 Subject: This version seems to work. svn path=/trunk/; revision=711 --- socket.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/socket.c b/socket.c index 385b458e..4b4f5279 100644 --- a/socket.c +++ b/socket.c @@ -38,9 +38,10 @@ * There are, in effect, two different implementations here. One * uses read(2) and write(2) directly with no buffering, the other * uses stdio with line buffering (for better throughput). Both - * are known to work under Linux. + * are known to work under Linux. You get the former by configuring + * with --disable-stdio, the latter by configuring with --enable-stdio + * or by default. */ -/* #define USE_STDIO */ #ifdef USE_STDIO /* @@ -162,12 +163,17 @@ char *SockGets(char *buf, int len, FILE *sockfp) int SockWrite(char *buf, int size, int len, FILE *sockfp) { - return(fwrite(buf, size, len, sockfp)); + int n = fwrite(buf, size, len, sockfp); + + fseek(sockfp, 0L, SEEK_CUR); /* required by POSIX */ + + return(n); } char *SockGets(char *buf, int len, FILE *sockfp) { return(fgets(buf, len, sockfp)); + } #endif -- cgit v1.2.3