From: Serge Hallyn Date: Fri, 18 Oct 2013 15:31:27 +0000 (-0500) Subject: parse.c: don't print error message on callback rv > 0 X-Git-Tag: lxc-1.0.0.alpha2~12 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8daccdb4d07d135f65516f095bb63e2bc988f208;p=thirdparty%2Flxc.git parse.c: don't print error message on callback rv > 0 A callback return value < 0 means there was an error, so print out an error message. But a rv > 0 is used by the mount_unknown_fs functions to say "we found the one we want, stop here." Document this, and only print an error message if rv < 0. Otherwise, lxc-create -B lvm --fstype ext3 -t ubuntu -n u1 will print an (innocuous) error message about being unable to parse the config value 'ext3'. Signed-off-by: Serge Hallyn Acked-by: Stéphane Graber --- diff --git a/src/lxc/parse.c b/src/lxc/parse.c index 5fca79ef0..dcf5cf02d 100644 --- a/src/lxc/parse.c +++ b/src/lxc/parse.c @@ -102,7 +102,10 @@ int lxc_file_for_each_line(const char *file, lxc_file_cb callback, void *data) while (getline(&line, &len, f) != -1) { err = callback(line, data); if (err) { - ERROR("Failed to parse config: %s", line); + // callback rv > 0 means stop here + // callback rv < 0 means error + if (err < 0) + ERROR("Failed to parse config: %s", line); break; } }