FreeBSD/contrib/openbsm/libbsm/bsm_audit.c
/*
 * au_close(), except onto an in-memory buffer.  Buffer size as an argument,
 * record size returned via same argument on success.
 */
au_close(), except onto an in-memory buffer.  Buffer size as an argument,
record size returned via same argument on success.
au_close () except onto an in - memory buffer . Buffer size as an argument record size returned via same argument on success .
int
au_close_buffer(int d, short event, u_char *buffer, size_t *buflen)
{
	size_t tot_rec_size;
	au_record_t *rec;
	int retval;
	rec = open_desc_table[d];
	if ((rec == NULL) || (rec->used == 0)) {
		errno = EINVAL;
		return (-1);
	}
	retval = 0;
	tot_rec_size = rec->len + MAX_AUDIT_HEADER_SIZE + AUDIT_TRAILER_SIZE;
	if ((tot_rec_size > MAX_AUDIT_RECORD_SIZE) ||
	    (tot_rec_size > *buflen)) {
		fprintf(stderr, "au_close_buffer failed %zd", tot_rec_size);
		errno = ENOMEM;
		retval = -1;
		goto cleanup;
	}
	if (au_assemble(rec, event) < 0) {
		retval = -1;
		goto cleanup;
	}
	memcpy(buffer, rec->data, rec->len);
	*buflen = rec->len;
cleanup:
	au_teardown(rec);
	return (retval);
}
int au_close_buffer ( int d , short event , u_char * buffer , size_t * buflen ) { size_t tot_rec_size ; au_record_t * rec ; int retval ; rec = open_desc_table [ d ] ; if ( ( rec == NULL ) || ( rec -> used == 0 ) ) { errno = EINVAL ; return ( -1 ) ; } retval = 0 ; tot_rec_size = rec -> len + MAX_AUDIT_HEADER_SIZE + AUDIT_TRAILER_SIZE ; if ( ( tot_rec_size > MAX_AUDIT_RECORD_SIZE ) || ( tot_rec_size > * buflen ) ) { fprintf ( stderr , " " , tot_rec_size ) ; errno = ENOMEM ; retval = -1 ; goto cleanup ; } if ( au_assemble ( rec , event ) < 0 ) { retval = -1 ; goto cleanup ; } memcpy ( buffer , rec -> data , rec -> len ) ; * buflen = rec -> len ; cleanup : au_teardown ( rec ) ; return ( retval ) ; }
au_close(), except onto an in-memory buffer.
au_close () except onto an in - memory buffer .
/*
		 * XXXRW: See au_close() comment.
		 */ /* XXXRW: See au_close() comment. */