From 5eb0ec070c8d43011b860591c6caba8d84e79331 Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Mon, 19 May 2003 10:37:09 +0000 Subject: [PATCH] ITS#2490 - more retry checks --- libraries/liblber/dtest.c | 13 +++++++++---- libraries/liblber/io.c | 5 +++++ 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/libraries/liblber/dtest.c b/libraries/liblber/dtest.c index 387bf6dcc1..32ea47713d 100644 --- a/libraries/liblber/dtest.c +++ b/libraries/liblber/dtest.c @@ -24,6 +24,7 @@ #include #include #include +#include #ifdef HAVE_CONSOLE_H #include @@ -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", diff --git a/libraries/liblber/io.c b/libraries/liblber/io.c index bab1fbe91c..9428e1f602 100644 --- a/libraries/liblber/io.c +++ b/libraries/liblber/io.c @@ -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; } } -- 2.39.5