[libvirt] [PATCH 2/4] lxc: print ENOTSUP when usernamespace is not supported

Martin Kletzander mkletzan at redhat.com
Tue Jul 15 09:24:06 UTC 2014


On Tue, Jul 15, 2014 at 04:32:01PM +0800, Jincheng Miao wrote:
>In lxcContainerStart, when user namespace is not supported,
>the virReportSystemError is called. But the first argument
>should be ENOTSUPP, instead of VIR_ERR_CONFIG_UNSUPPORTED.
>
>Signed-off-by: Jincheng Miao <jmiao at redhat.com>
>---
> src/lxc/lxc_container.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
>diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c
>index 4d89677..343df47 100644
>--- a/src/lxc/lxc_container.c
>+++ b/src/lxc/lxc_container.c
>@@ -2020,7 +2020,7 @@ int lxcContainerStart(virDomainDefPtr def,
>             VIR_DEBUG("Enable user namespace");
>             cflags |= CLONE_NEWUSER;
>         } else {
>-            virReportSystemError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
>+            virReportSystemError(ENOTSUP, "%s",
>                                  _("Kernel doesn't support user namespace"));
>             VIR_FREE(stack);
>             return -1;
>--
>1.8.3.1
>

Using virReportSystemError() with anything else than 'errno' is a
misuse by my standards.  Just use virReportError() instead if there's
VIR_ERR_CONFIG_UNSUPPORTED used.

Martin

P.S.: The same applies for following patches.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20140715/1f4366c8/attachment-0001.sig>


More information about the libvir-list mailing list