From abee001c11e41eaf38f4f2adcc636be3b625d296 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Michal=20Voc=C5=AF?= Date: Tue, 15 Mar 2011 16:00:04 +0000 Subject: [PATCH] fix config file parsing --- org.glite.lb.logger/src/interlogd.c | 40 +++++++++++++++++++------------------ 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/org.glite.lb.logger/src/interlogd.c b/org.glite.lb.logger/src/interlogd.c index 52172cd..cb2f7a9 100644 --- a/org.glite.lb.logger/src/interlogd.c +++ b/org.glite.lb.logger/src/interlogd.c @@ -538,27 +538,29 @@ main (int argc, char **argv) char *p; char name[MAXPATHLEN+1]; - /* next line */ - s = strchr(s, '\n'); - if(s) s++; - while(s) { - if(*s == 0 || *s == '[') - break; - /* parse line */ - p = strchr(s, '\n'); - if(p) { - *p = 0; - } - /* XXX possible overflow by long line in config file */ - ret = sscanf(s, " plugin =%s", name); - if(p) *p = '\n'; - if(ret > 0) { - glite_common_log(LOG_CATEGORY_CONTROL, LOG_PRIORITY_INFO, " loading plugin %s\n", name); - if(plugin_mgr_init(name, config) < 0) { - glite_common_log(LOG_CATEGORY_CONTROL, LOG_PRIORITY_ERROR, "Failed to load plugin %s: %s\n", name, error_get_msg()); + if(s) { + /* next line */ + s = strchr(s, '\n'); + if(s) s++; + while(s) { + if(*s == 0 || *s == '[') + break; + /* parse line */ + p = strchr(s, '\n'); + if(p) { + *p = 0; + } + /* XXX possible overflow by long line in config file */ + ret = sscanf(s, " plugin =%s", name); + if(p) *p = '\n'; + if(ret > 0) { + glite_common_log(LOG_CATEGORY_CONTROL, LOG_PRIORITY_INFO, " loading plugin %s\n", name); + if(plugin_mgr_init(name, config) < 0) { + glite_common_log(LOG_CATEGORY_CONTROL, LOG_PRIORITY_ERROR, "Failed to load plugin %s: %s\n", name, error_get_msg()); + } } + s = p + 1; } - s = p + 1; } } -- 1.8.2.3