summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorerdgeist <>2010-08-18 00:43:12 +0000
committererdgeist <>2010-08-18 00:43:12 +0000
commit216447492a88a65cc01f3bb19352e4dafb263a6a (patch)
treefbfb1af59e7a13d4dfb11066ba15679eeeb0f68c
parentaae0227ee66ffbb3ddc507d0be89854c23bd88af (diff)
Chomp all trailing space characters, including new lines, when parsing the config file
-rw-r--r--opentracker.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/opentracker.c b/opentracker.c
index 579e41e..bb024b0 100644
--- a/opentracker.c
+++ b/opentracker.c
@@ -374,8 +374,8 @@ int parse_configfile( char * config_filename ) {
374 } 374 }
375 375
376 while( fgets( inbuf, sizeof(inbuf), accesslist_filehandle ) ) { 376 while( fgets( inbuf, sizeof(inbuf), accesslist_filehandle ) ) {
377 char *newl;
378 char *p = inbuf; 377 char *p = inbuf;
378 size_t strl;
379 379
380 /* Skip white spaces */ 380 /* Skip white spaces */
381 while(isspace(*p)) ++p; 381 while(isspace(*p)) ++p;
@@ -383,8 +383,10 @@ int parse_configfile( char * config_filename ) {
383 /* Ignore comments and empty lines */ 383 /* Ignore comments and empty lines */
384 if((*p=='#')||(*p=='\n')||(*p==0)) continue; 384 if((*p=='#')||(*p=='\n')||(*p==0)) continue;
385 385
386 /* chomp */ 386 /* consume trailing new lines and spaces */
387 if(( newl = strchr(p, '\n' ))) *newl = 0; 387 strl = strlen(p);
388 while( strl && isspace(p[strl-1]))
389 p[--strl] = 0;
388 390
389 /* Scan for commands */ 391 /* Scan for commands */
390 if(!byte_diff(p,15,"tracker.rootdir" ) && isspace(p[15])) { 392 if(!byte_diff(p,15,"tracker.rootdir" ) && isspace(p[15])) {