1
0
mirror of git://erdgeist.org/opentracker synced 2025-01-14 17:00:07 +00:00

Chomp all trailing space characters, including new lines, when parsing the config file

This commit is contained in:
erdgeist 2010-08-18 00:43:12 +00:00
parent aae0227ee6
commit 216447492a

View File

@ -374,8 +374,8 @@ int parse_configfile( char * config_filename ) {
} }
while( fgets( inbuf, sizeof(inbuf), accesslist_filehandle ) ) { while( fgets( inbuf, sizeof(inbuf), accesslist_filehandle ) ) {
char *newl;
char *p = inbuf; char *p = inbuf;
size_t strl;
/* Skip white spaces */ /* Skip white spaces */
while(isspace(*p)) ++p; while(isspace(*p)) ++p;
@ -383,8 +383,10 @@ int parse_configfile( char * config_filename ) {
/* Ignore comments and empty lines */ /* Ignore comments and empty lines */
if((*p=='#')||(*p=='\n')||(*p==0)) continue; if((*p=='#')||(*p=='\n')||(*p==0)) continue;
/* chomp */ /* consume trailing new lines and spaces */
if(( newl = strchr(p, '\n' ))) *newl = 0; strl = strlen(p);
while( strl && isspace(p[strl-1]))
p[--strl] = 0;
/* Scan for commands */ /* Scan for commands */
if(!byte_diff(p,15,"tracker.rootdir" ) && isspace(p[15])) { if(!byte_diff(p,15,"tracker.rootdir" ) && isspace(p[15])) {