[lxc-devel] [PATCH 1/1] parse.c: don't print error message on callback rv > 0
Stéphane Graber
stgraber at ubuntu.com
Fri Oct 18 16:10:53 UTC 2013
On Fri, Oct 18, 2013 at 10:33:32AM -0500, Serge Hallyn wrote:
> 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 <serge.hallyn at ubuntu.com>
Acked-by: Stéphane Graber <stgraber at ubuntu.com>
> ---
> src/lxc/parse.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/src/lxc/parse.c b/src/lxc/parse.c
> index 5fca79e..dcf5cf0 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;
> }
> }
> --
> 1.8.3.2
>
>
> ------------------------------------------------------------------------------
> October Webinars: Code for Performance
> Free Intel webinars can help you accelerate application performance.
> Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from
> the latest Intel processors and coprocessors. See abstracts and register >
> http://pubads.g.doubleclick.net/gampad/clk?id=60135031&iu=/4140/ostg.clktrk
> _______________________________________________
> Lxc-devel mailing list
> Lxc-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/lxc-devel
--
Stéphane Graber
Ubuntu developer
http://www.ubuntu.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20131018/3ab46b01/attachment.pgp>
More information about the lxc-devel
mailing list