提交 b04e39ff 编写于 作者: M Martin Kletzander

admin: Check for flags properly

Function virAdmConnectListServers() forgot to check for flags at all,
virAdmConnectOpen() on the other hand checked them but did no dispatch
the error.  virCheckFlags() should be used only when there should be no
other thing done after erroring out and since they are used on different
places then just public API, they cannot dispatch errors.  So let's use
virCheckFlagsGoto instead.
Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
上级 23a646f8
......@@ -185,7 +185,7 @@ virAdmGetDefaultURI(virConfPtr conf)
/**
* virAdmConnectOpen:
* @name: uri of the daemon to connect to, NULL for default
* @flags: unused, must be 0
* @flags: extra flags; not used yet, so callers should always pass 0
*
* Opens connection to admin interface of the daemon.
*
......@@ -204,7 +204,7 @@ virAdmConnectOpen(const char *name, unsigned int flags)
VIR_DEBUG("flags=%x", flags);
virResetLastError();
virCheckFlags(VIR_CONNECT_NO_ALIASES, NULL);
virCheckFlagsGoto(VIR_CONNECT_NO_ALIASES, error);
if (!(conn = virAdmConnectNew()))
goto error;
......@@ -603,7 +603,7 @@ int virAdmServerFree(virAdmServerPtr srv)
* @conn: daemon connection reference
* @servers: Pointer to a list to store an array containing objects or NULL
* if the list is not required (number of servers only)
* @flags: bitwise-OR of virAdmConnectListServersFlags
* @flags: extra flags; not used yet, so callers should always pass 0
*
* Collect list of all servers provided by daemon the client is connected to.
*
......@@ -624,6 +624,7 @@ virAdmConnectListServers(virAdmConnectPtr conn,
VIR_DEBUG("conn=%p, servers=%p, flags=%x", conn, servers, flags);
virResetLastError();
virCheckFlagsGoto(0, error);
if (servers)
*servers = NULL;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册