X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=src%2Fconf-parser.c;h=a71dcd0d8fb8c87460ea24f81b244334ce740519;hp=970877650d642a269e27c8b2a28266c671646410;hb=de7b95cdc3228131498021c2fdcf6647004c3920;hpb=f975e971accc4d50c73ae53167db3df7a7099cf2 diff --git a/src/conf-parser.c b/src/conf-parser.c index 970877650..a71dcd0d8 100644 --- a/src/conf-parser.c +++ b/src/conf-parser.c @@ -88,7 +88,8 @@ int config_item_perf_lookup( else { char *key; - if (asprintf(&key, "%s.%s", section, lvalue) < 0) + key = join(section, ".", lvalue, NULL); + if (!key) return -ENOMEM; p = lookup(key, strlen(key)); @@ -131,8 +132,12 @@ static int next_assignment( if (r < 0) return r; - if (func) - return func(filename, line, section, lvalue, ltype, rvalue, data, userdata); + if (r > 0) { + if (func) + return func(filename, line, section, lvalue, ltype, rvalue, data, userdata); + + return 0; + } /* Warn about unknown non-extension fields. */ if (!relaxed && !startswith(lvalue, "X-")) @@ -309,7 +314,7 @@ int config_parse( continuation = c; else { continuation = strdup(l); - if (!c) { + if (!continuation) { r = -ENOMEM; goto finish; }