ITS#9811 Allow newlines at end of included file

This commit is contained in:
Ondřej Kuzník 2022-03-18 14:51:45 +00:00 committed by Quanah Gibson-Mount
parent 252a7dbbd0
commit 0dae0704c0

View file

@ -796,6 +796,7 @@ ldif_read_record(
* back to a previous file. (return from an include) * back to a previous file. (return from an include)
*/ */
while ( feof( lfp->fp )) { while ( feof( lfp->fp )) {
pop:
if ( lfp->prev ) { if ( lfp->prev ) {
LDIFFP *tmp = lfp->prev; LDIFFP *tmp = lfp->prev;
fclose( lfp->fp ); fclose( lfp->fp );
@ -808,6 +809,10 @@ ldif_read_record(
} }
if ( !stop ) { if ( !stop ) {
if ( fgets( line, sizeof( line ), lfp->fp ) == NULL ) { if ( fgets( line, sizeof( line ), lfp->fp ) == NULL ) {
if ( !found_entry && !ferror( lfp->fp ) ) {
/* ITS#9811 Reached the end looking for an entry, try again */
goto pop;
}
stop = 1; stop = 1;
len = 0; len = 0;
} else { } else {