]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
Allow enabling or disabling timesync multiple times.
authorOliver Kurth <okurth@vmware.com>
Fri, 15 Sep 2017 18:23:26 +0000 (11:23 -0700)
committerOliver Kurth <okurth@vmware.com>
Fri, 15 Sep 2017 18:23:26 +0000 (11:23 -0700)
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.

open-vm-tools/toolbox/toolboxcmd-time.c

index 5c011d662c730fb9b62fc47b755fff777b4ea556..d7848f120f1612efe34391c3cc29e9e551757991 100644 (file)
@@ -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);