From bfa6808c487154dcf481873868372e4c86d1443e Mon Sep 17 00:00:00 2001 From: Kurt Zeilenga Date: Thu, 22 May 2003 03:35:36 +0000 Subject: [PATCH] Fix dtest ber_get_next() usage --- libraries/liblber/dtest.c | 16 +++++++++------- libraries/liblber/io.c | 3 --- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/libraries/liblber/dtest.c b/libraries/liblber/dtest.c index 32ea47713d..e7a4a3f7d6 100644 --- a/libraries/liblber/dtest.c +++ b/libraries/liblber/dtest.c @@ -76,16 +76,18 @@ main( int argc, char **argv ) 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 ); - } + if( tag != LBER_ERROR ) break; + + 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", - (unsigned long) tag, (long) len ); + (unsigned long) tag, (long) len ); for( s = argv[1]; *s; s++ ) { char buf[128]; diff --git a/libraries/liblber/io.c b/libraries/liblber/io.c index 2aab7d0040..4815bbcd1a 100644 --- a/libraries/liblber/io.c +++ b/libraries/liblber/io.c @@ -500,10 +500,7 @@ ber_get_next( */ if (ber->ber_rwptr == NULL) { -#if 0 - /* XXYYZ - dtest does like this assert. */ assert( ber->ber_buf == NULL ); -#endif ber->ber_rwptr = (char *) &ber->ber_len-1; ber->ber_ptr = ber->ber_rwptr; ber->ber_tag = 0; -- 2.39.2