]> git.sur5r.net Git - openldap/commitdiff
ITS#2490 - more retry checks
authorHoward Chu <hyc@openldap.org>
Mon, 19 May 2003 10:37:09 +0000 (10:37 +0000)
committerHoward Chu <hyc@openldap.org>
Mon, 19 May 2003 10:37:09 +0000 (10:37 +0000)
libraries/liblber/dtest.c
libraries/liblber/io.c

index 387bf6dcc18f40e9f2eaf123c60733434a2c6727..32ea47713dd93ccd7a94b1fda4118f6722cf468c 100644 (file)
@@ -24,6 +24,7 @@
 #include <ac/string.h>
 #include <ac/socket.h>
 #include <ac/unistd.h>
+#include <ac/errno.h>
 
 #ifdef HAVE_CONSOLE_H
 #include <console.h>
@@ -73,10 +74,14 @@ main( int argc, char **argv )
                return( EXIT_FAILURE );
        }
 
-       tag = ber_get_next( sb, &len, ber);
-       if( tag == LBER_ERROR ) {
-               perror( "ber_get_next" );
-               return( EXIT_FAILURE );
+       for (;;) {
+               tag = ber_get_next( sb, &len, ber);
+               if( tag == LBER_ERROR ) {
+                       if( errno == EWOULDBLOCK ) continue;
+                       if( errno == EAGAIN ) continue;
+                       perror( "ber_get_next" );
+                       return( EXIT_FAILURE );
+               }
        }
 
        printf("decode: message tag 0x%lx and length %ld\n",
index bab1fbe91c904e2d0502b4f9a385e586c3f0090a..9428e1f6021a7b454169f30cefe5195c6bbad669 100644 (file)
@@ -540,6 +540,11 @@ ber_get_next(
                                }
                                /* Did we run out of bytes? */
                                if ((char *)p == ber->ber_rwptr) {
+#if defined( EWOULDBLOCK )
+                                       errno = EWOULDBLOCK;
+#elif defined( EAGAIN )
+                                       errno = EAGAIN;
+#endif                 
                                        return LBER_DEFAULT;
                                }
                        }