Fix win32 bug in pmutility.c
authorDaniel Ferguson <daniel.j.ferguson@intel.com>
Mon, 6 Jun 2016 20:19:40 +0000 (13:19 -0700)
committerDavid Antler <david.a.antler@intel.com>
Tue, 7 Jun 2016 20:39:25 +0000 (20:39 +0000)
Win32 implementation of pmutility.c:PMTimeout() was broken

Change-Id: I313fac3b7fc2437ad5de89baf03600a01516ed24
Signed-off-by: Daniel Ferguson <daniel.j.ferguson@intel.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/8503
Reviewed-by: David Antler <david.a.antler@intel.com>
Reviewed-by: Dave Thaler <dthaler@microsoft.com>
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
resource/csdk/security/provisioning/src/pmutility.c

index b52fe47..cdf68b9 100644 (file)
@@ -356,7 +356,6 @@ OCStackResult PMTimeout(unsigned short waittime, bool waitForStackResponse)
 #if defined(HAVE_GETSYSTEMTIMEASFILETIME)
     FILETIME startTime = {0};
     FILETIME currTime = {0};
-    int clock_res = 1;
 
     GetSystemTimeAsFileTime(&startTime);
 #elif defined(HAVE_CLOCK_GETTIME)
@@ -368,16 +367,16 @@ OCStackResult PMTimeout(unsigned short waittime, bool waitForStackResponse)
 # else
     int clock_res = clock_gettime(CLOCK_REALTIME, &startTime);
 # endif // defined(_POSIX_MONOTONIC_CLOCK)
+    if (0 != clock_res)
+    {
+        return OC_STACK_ERROR;
+    }
 
 #else
     ERROR Need PMTimeout implementation
     return OC_STACK_ERROR;
 #endif
 
-    if (0 != clock_res)
-    {
-        return OC_STACK_ERROR;
-    }
     while (OC_STACK_OK == res)
     {
 #if defined(HAVE_GETSYSTEMTIMEASFILETIME)