提交 a6b00cbb 编写于 作者: M Matthias Bolte

esx: Cleanup preprocessing structure in esxVI_EnsureSession

上级 ce71bfa8
...@@ -1317,16 +1317,18 @@ esxVI_BuildFullTraversalSpecList(esxVI_SelectionSpec **fullTraversalSpecList) ...@@ -1317,16 +1317,18 @@ esxVI_BuildFullTraversalSpecList(esxVI_SelectionSpec **fullTraversalSpecList)
* you try to call it. Query the session manager for the current session of * you try to call it. Query the session manager for the current session of
* this connection instead and re-login if there is no current session for this * this connection instead and re-login if there is no current session for this
* connection. * connection.
*
* Update: 'ESX 4.0.0 build-171294' doesn't implement this method.
*/ */
#define ESX_VI_USE_SESSION_IS_ACTIVE 0 #define ESX_VI_USE_SESSION_IS_ACTIVE 0
int int
esxVI_EnsureSession(esxVI_Context *ctx) esxVI_EnsureSession(esxVI_Context *ctx)
{ {
int result = 0;
#if ESX_VI_USE_SESSION_IS_ACTIVE #if ESX_VI_USE_SESSION_IS_ACTIVE
esxVI_Boolean active = esxVI_Boolean_Undefined; esxVI_Boolean active = esxVI_Boolean_Undefined;
#else #else
int result = 0;
esxVI_String *propertyNameList = NULL; esxVI_String *propertyNameList = NULL;
esxVI_ObjectContent *sessionManager = NULL; esxVI_ObjectContent *sessionManager = NULL;
esxVI_DynamicProperty *dynamicProperty = NULL; esxVI_DynamicProperty *dynamicProperty = NULL;
...@@ -1352,6 +1354,8 @@ esxVI_EnsureSession(esxVI_Context *ctx) ...@@ -1352,6 +1354,8 @@ esxVI_EnsureSession(esxVI_Context *ctx)
return -1; return -1;
} }
} }
return 0;
#else #else
if (esxVI_String_AppendValueToList(&propertyNameList, if (esxVI_String_AppendValueToList(&propertyNameList,
"currentSession") < 0 || "currentSession") < 0 ||
...@@ -1388,16 +1392,11 @@ esxVI_EnsureSession(esxVI_Context *ctx) ...@@ -1388,16 +1392,11 @@ esxVI_EnsureSession(esxVI_Context *ctx)
"last login"); "last login");
goto failure; goto failure;
} }
#endif
cleanup: cleanup:
#if ESX_VI_USE_SESSION_IS_ACTIVE
/* nothing */
#else
esxVI_String_Free(&propertyNameList); esxVI_String_Free(&propertyNameList);
esxVI_ObjectContent_Free(&sessionManager); esxVI_ObjectContent_Free(&sessionManager);
esxVI_UserSession_Free(&currentSession); esxVI_UserSession_Free(&currentSession);
#endif
return result; return result;
...@@ -1405,8 +1404,7 @@ esxVI_EnsureSession(esxVI_Context *ctx) ...@@ -1405,8 +1404,7 @@ esxVI_EnsureSession(esxVI_Context *ctx)
result = -1; result = -1;
goto cleanup; goto cleanup;
#endif
return 0;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册