From: Michal Voců Date: Tue, 15 Mar 2011 16:00:04 +0000 (+0000) Subject: fix config file parsing X-Git-Tag: glite-lbjp-common-db_R_3_0_2_1~10 X-Git-Url: http://scientific.zcu.cz/git/?a=commitdiff_plain;h=abee001c11e41eaf38f4f2adcc636be3b625d296;p=jra1mw.git fix config file parsing --- 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; } }