From: VMware, Inc <> Date: Mon, 26 Apr 2010 17:57:21 +0000 (-0700) Subject: Changes in shared code that don't affect open-vm-tools functionality. X-Git-Tag: 2010.04.25-253928~61 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5121ca5e24d7942a955a4808ea3913969b5ef540;p=thirdparty%2Fopen-vm-tools.git Changes in shared code that don't affect open-vm-tools functionality. Signed-off-by: Marcelo Vanzin --- diff --git a/open-vm-tools/services/vmtoolsd/serviceObj.c b/open-vm-tools/services/vmtoolsd/serviceObj.c index 744759213..1c23454c3 100644 --- a/open-vm-tools/services/vmtoolsd/serviceObj.c +++ b/open-vm-tools/services/vmtoolsd/serviceObj.c @@ -97,10 +97,19 @@ ToolsCoreCapabilitiesAccumulator(GSignalInvocationHint *ihint, * Accumulator function for the "service control" signal. Updates the return * value according to the signal's documentation. * - * @param[in] ihint Unused. - * @param[out] retval Return value of the signal. - * @param[in] handlerRet Return value from the current handler. - * @param[in] data Unused. + * The gobject library initializes the return value to "0" regardless of + * what the signal emitter sets it to. So the accumulator does two things + * to have a non-zero default return value: + * + * - if the current return value is zero, it's set to the default return + * value (ERROR_CALL_NOT_IMPLEMENTED). + * - the return value is always offset by one; so the signal emitter + * should decrement the return value when looking at it. + * + * @param[in] ihint Unused. + * @param[in,out] retval Return value of the signal (offset by 1). + * @param[in] handlerRet Return value from the current handler. + * @param[in] data Unused. * * @return TRUE. */ @@ -113,25 +122,32 @@ ToolsCoreServiceControlAccumulator(GSignalInvocationHint *ihint, { guint ret = g_value_get_uint(retval); guint handlerVal = g_value_get_uint(handlerRet); + + if (ret == 0) { + ret = ERROR_CALL_NOT_IMPLEMENTED + 1; + } + switch (ret) { - case ERROR_CALL_NOT_IMPLEMENTED: - ret = handlerVal; + case ERROR_CALL_NOT_IMPLEMENTED + 1: + ret = handlerVal + 1; break; - case NO_ERROR: + case NO_ERROR + 1: if (handlerVal != ERROR_CALL_NOT_IMPLEMENTED) { - ret = handlerVal; + ret = handlerVal + 1; } break; default: break; } + g_value_set_uint(retval, ret); return TRUE; } #endif + /** * Initializes the ToolsCoreService class. Sets up the signals that are sent * by the vmtoolsd service. @@ -212,7 +228,7 @@ ToolsCore_Service_class_init(gpointer _klass, G_OBJECT_CLASS_TYPE(klass), G_SIGNAL_RUN_LAST, 0, - NULL, + ToolsCoreServiceControlAccumulator, NULL, g_cclosure_user_marshal_UINT__POINTER_POINTER_UINT_UINT_POINTER, G_TYPE_UINT,