mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-12-22 23:59:34 -05:00
Trim both \n and \r\n from config files.
This commit is contained in:
parent
790a18cb86
commit
2af75ecc6a
2 changed files with 7 additions and 1 deletions
|
|
@ -2227,7 +2227,9 @@ fp_getline( FILE *fp, int *lineno )
|
|||
}
|
||||
|
||||
while ( fgets( buf, sizeof(buf), fp ) != NULL ) {
|
||||
/* trim off \r\n or \n */
|
||||
if ( (p = strchr( buf, '\n' )) != NULL ) {
|
||||
if( p > buf && p[-1] == '\r' ) --p;
|
||||
*p = '\0';
|
||||
}
|
||||
if ( ! isspace( (unsigned char) buf[0] ) ) {
|
||||
|
|
|
|||
|
|
@ -259,13 +259,17 @@ getline(
|
|||
CATLINE( buf );
|
||||
while ( fgets( buf, sizeof(buf), fp ) != NULL ) {
|
||||
if ( (p = strchr( buf, '\n' )) != NULL ) {
|
||||
*p = '\0';
|
||||
if( p > buf && p[-1] == '\r' ) --p;
|
||||
*p = '\0';
|
||||
}
|
||||
lineno++;
|
||||
if ( ! isspace( (unsigned char) buf[0] ) ) {
|
||||
return( line );
|
||||
}
|
||||
|
||||
/* change leading whitespace to space */
|
||||
buf[0] = ' ';
|
||||
|
||||
CATLINE( buf );
|
||||
}
|
||||
buf[0] = '\0';
|
||||
|
|
|
|||
Loading…
Reference in a new issue