mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-12-22 07:39:35 -05:00
ITS#6723: Handle EOF in test programs
This commit is contained in:
parent
def5d26f13
commit
7c29e2c7c5
2 changed files with 5 additions and 7 deletions
|
|
@ -81,11 +81,9 @@ main( int argc, char *argv[] )
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( strcmp( argv[ 1 ], "-" ) == 0 ) {
|
if ( strcmp( argv[ 1 ], "-" ) == 0 ) {
|
||||||
size_t len;
|
size_t len = fgets( buf, sizeof( buf ), stdin ) ? strlen( buf ) : 0;
|
||||||
|
|
||||||
fgets( buf, sizeof( buf ), stdin );
|
if ( len == 0 || buf[ --len ] == '\n' ) {
|
||||||
len = strlen( buf );
|
|
||||||
if ( len > 0 && buf[ --len ] == '\n' ) {
|
|
||||||
buf[ len ] = '\0';
|
buf[ len ] = '\0';
|
||||||
}
|
}
|
||||||
strin = buf;
|
strin = buf;
|
||||||
|
|
@ -296,4 +294,3 @@ main( int argc, char *argv[] )
|
||||||
|
|
||||||
return( 0 );
|
return( 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -990,7 +990,8 @@ get_search_filters( char *filename, char *filters[], char *attrs[], char *bases[
|
||||||
} else {
|
} else {
|
||||||
bases[filter] = ArgDup( line );
|
bases[filter] = ArgDup( line );
|
||||||
}
|
}
|
||||||
fgets( line, BUFSIZ, fp );
|
if ( fgets( line, BUFSIZ, fp ) == NULL )
|
||||||
|
*line = '\0';
|
||||||
if (( nl = strchr( line, '\r' )) || ( nl = strchr( line, '\n' )))
|
if (( nl = strchr( line, '\r' )) || ( nl = strchr( line, '\n' )))
|
||||||
*nl = '\0';
|
*nl = '\0';
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue