From: Oliver Kurth Date: Fri, 15 Sep 2017 18:23:26 +0000 (-0700) Subject: Allow enabling or disabling timesync multiple times. X-Git-Tag: stable-10.2.0~330 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=1aaa5e267bb500a77a2d3771e780ffb09134fc10;p=thirdparty%2Fopen-vm-tools.git Allow enabling or disabling timesync multiple times. Toolbox cmd sends a presumed old value for timesync GuestRpc when enabling or disabling timesync. VMX side expects the guest side to be aware of old value and therefore errors out whenever guest repeats the operation. Previously the implementation was silently ignoring the error. Avoid sending the guestRpc to enable or disable timesync when it is already in the desired state (enabled or disabled respectively). It is optimal and also avoids the unnecessary error. --- diff --git a/open-vm-tools/toolbox/toolboxcmd-time.c b/open-vm-tools/toolbox/toolboxcmd-time.c index 5c011d662..d7848f120 100644 --- a/open-vm-tools/toolbox/toolboxcmd-time.c +++ b/open-vm-tools/toolbox/toolboxcmd-time.c @@ -110,7 +110,8 @@ TimeSyncEnable(void) char *reply = NULL; size_t replyLen; - if (TimeSyncSet(TRUE, &reply, &replyLen)) { + if ((TimeSyncGetOldOptions() & VMWARE_GUI_SYNC_TIME) || + TimeSyncSet(TRUE, &reply, &replyLen)) { ToolsCmd_Print("%s\n", SU_(option.enabled, "Enabled")); } else { ToolsCmd_PrintErr(SU_(error.message, "Error: %s\n"), reply); @@ -145,7 +146,8 @@ TimeSyncDisable(void) char *reply = NULL; size_t replyLen; - if (TimeSyncSet(FALSE, &reply, &replyLen)) { + if (!(TimeSyncGetOldOptions() & VMWARE_GUI_SYNC_TIME) || + TimeSyncSet(FALSE, &reply, &replyLen)) { ToolsCmd_Print("%s\n", SU_(option.disabled, "Disabled")); } else { ToolsCmd_PrintErr(SU_(error.message, "Error: %s\n"), reply);