summaryrefslogtreecommitdiff
path: root/xserver/os
diff options
context:
space:
mode:
Diffstat (limited to 'xserver/os')
-rw-r--r--xserver/os/access.c4
-rw-r--r--xserver/os/utils.c16
2 files changed, 18 insertions, 2 deletions
diff --git a/xserver/os/access.c b/xserver/os/access.c
index 027925927..eb91ea35e 100644
--- a/xserver/os/access.c
+++ b/xserver/os/access.c
@@ -1145,8 +1145,10 @@ Bool LocalClient(ClientPtr client)
}
for (host = selfhosts; host; host = host->next)
{
- if (addrEqual (family, addr, alen, host))
+ if (addrEqual (family, addr, alen, host)) {
+ free(from);
return TRUE;
+ }
}
free(from);
}
diff --git a/xserver/os/utils.c b/xserver/os/utils.c
index c1836ac84..f45f9b4a4 100644
--- a/xserver/os/utils.c
+++ b/xserver/os/utils.c
@@ -445,7 +445,21 @@ GetTimeInMillis(void)
#ifdef MONOTONIC_CLOCK
struct timespec tp;
- if (clock_gettime(CLOCK_MONOTONIC, &tp) == 0)
+ static clockid_t clockid;
+ if (!clockid) {
+#ifdef CLOCK_MONOTONIC_COARSE
+ if (clock_getres(CLOCK_MONOTONIC_COARSE, &tp) == 0 &&
+ (tp.tv_nsec / 1000) <= 1000 &&
+ clock_gettime(CLOCK_MONOTONIC_COARSE, &tp) == 0)
+ clockid = CLOCK_MONOTONIC_COARSE;
+ else
+#endif
+ if (clock_gettime(CLOCK_MONOTONIC, &tp) == 0)
+ clockid = CLOCK_MONOTONIC;
+ else
+ clockid = ~0L;
+ }
+ if (clockid != ~0L && clock_gettime(clockid, &tp) == 0)
return (tp.tv_sec * 1000) + (tp.tv_nsec / 1000000L);
#endif