Set ber_errno here and there.

This commit is contained in:
Kurt Zeilenga 1999-12-06 06:33:26 +00:00
parent 15c83bef9d
commit 942d37afc5
4 changed files with 14 additions and 4 deletions

View File

@ -64,7 +64,7 @@ LDAP_BEGIN_DECL
* as valid BER tags, and so it is safe to use them to report errors. In
* fact, any tag for which the following is true is invalid:
*/
#define LBER_INVALID(t) (((t) & (ber_tag_t) 0x080) \
#define LBER_INVALID(t) (((t) & (ber_tag_t) 0x080UL) \
&& (((t) & (ber_tag_t) ~ 0x0FF))
#define LBER_ERROR ((ber_tag_t) -1)

View File

@ -299,8 +299,7 @@ ber_put_ostring(
#ifdef STR_TRANSLATION
if ( len > 0 && ( ber->ber_options & LBER_TRANSLATE_STRINGS ) != 0 &&
ber->ber_encode_translate_proc ) {
if ( (*(ber->ber_encode_translate_proc))( &str, &len, 0 )
!= 0 ) {
if ( (*(ber->ber_encode_translate_proc))( &str, &len, 0 ) != 0 ) {
return( -1 );
}
free_str = 1;

View File

@ -83,7 +83,6 @@ ber_memfree( void *p )
assert( ber_int_memory_fns->bmf_free );
(*ber_int_memory_fns->bmf_free)( p );
}
@ -268,10 +267,12 @@ ber_bvdup(
ber_int_options.lbo_valid = LBER_INITIALIZED;
if( bv == NULL ) {
ber_errno = LBER_ERROR_PARAM;
return NULL;
}
if(( new = LBER_MALLOC( sizeof(struct berval) )) == NULL ) {
ber_errno = LBER_ERROR_MEMORY;
return NULL;
}
@ -282,6 +283,7 @@ ber_bvdup(
}
if(( new->bv_val = LBER_MALLOC( bv->bv_len + 1 )) == NULL ) {
ber_errno = LBER_ERROR_MEMORY;
LBER_FREE( new );
return NULL;
}
@ -312,6 +314,7 @@ ber_strdup( LDAP_CONST char *s )
len = strlen( s ) + 1;
if ( (p = LBER_MALLOC( len )) == NULL ) {
ber_errno = LBER_ERROR_MEMORY;
return( NULL );
}

View File

@ -29,6 +29,7 @@ ber_get_option(
if(outvalue == NULL) {
/* no place to get to */
ber_errno = LBER_ERROR_PARAM;
return LBER_OPT_ERROR;
}
@ -38,6 +39,7 @@ ber_get_option(
return LBER_OPT_SUCCESS;
}
ber_errno = LBER_ERROR_PARAM;
return LBER_OPT_ERROR;
}
@ -69,6 +71,7 @@ ber_get_option(
default:
/* bad param */
ber_errno = LBER_ERROR_PARAM;
break;
}
@ -96,6 +99,7 @@ ber_set_option(
if(!( f->bmf_malloc && f->bmf_calloc
&& f->bmf_realloc && f->bmf_free ))
{
ber_errno = LBER_ERROR_PARAM;
return LBER_OPT_ERROR;
}
@ -103,6 +107,7 @@ ber_set_option(
(*(f->bmf_malloc))(sizeof(BerMemoryFunctions));
if ( ber_int_memory_fns == NULL ) {
ber_errno = LBER_ERROR_MEMORY;
return LBER_OPT_ERROR;
}
@ -116,6 +121,7 @@ ber_set_option(
if(invalue == NULL) {
/* no place to set from */
ber_errno = LBER_ERROR_PARAM;
return LBER_OPT_ERROR;
}
@ -129,6 +135,7 @@ ber_set_option(
return LBER_OPT_SUCCESS;
}
ber_errno = LBER_ERROR_PARAM;
return LBER_OPT_ERROR;
}
@ -160,6 +167,7 @@ ber_set_option(
default:
/* bad param */
ber_errno = LBER_ERROR_PARAM;
break;
}