Remove incorrect looping in edg_wll_socket_write().
authorJan Pospíšil <honik@ntc.zcu.cz>
Mon, 9 May 2005 12:57:25 +0000 (12:57 +0000)
committerJan Pospíšil <honik@ntc.zcu.cz>
Mon, 9 May 2005 12:57:25 +0000 (12:57 +0000)
org.glite.lb.common/src/log_msg.c

index d495cbf..d6adc91 100644 (file)
@@ -41,11 +41,14 @@ edg_wll_socket_write(
                gettimeofday(&before, NULL);
        }
        len = write(sock, buf, bufsize);
-       while ( len <= 0 ) {
+       if ( len <= 0  && errno == EAGAIN ) {
                FD_ZERO(&fds);
                FD_SET(sock,&fds);
-               if ( select(sock+1, &fds,NULL,NULL, timeout? &to: NULL) < 0 ) return -1;
-               len = write(sock, buf, bufsize);
+               if ( select(sock+1, NULL, &fds, NULL, timeout? &to: NULL) < 0 ) {
+                       len = -1;
+               } else {
+                       len = write(sock, buf, bufsize);
+               }
        }
        if ( timeout ) {
                gettimeofday(&after, NULL);