From: Waldemar Kozaczuk <[email protected]>
Committer: Waldemar Kozaczuk <[email protected]>
Branch: master

vdso: make clock_gettime() return -errno if it fails

Signed-off-by: Waldemar Kozaczuk <[email protected]>

---
diff --git a/libc/vdso/vdso.cc b/libc/vdso/vdso.cc
--- a/libc/vdso/vdso.cc
+++ b/libc/vdso/vdso.cc
@@ -21,7 +21,11 @@ extern "C" __attribute__((__visibility__("default")))
 int __vdso_clock_gettime(clockid_t clk_id, struct timespec *tp)
 {
     arch::tls_switch _tls_switch;
-    return clock_gettime(clk_id, tp);
+    if (clock_gettime(clk_id, tp) < 0) {
+        return -errno;
+    } else {
+        return 0;
+    }
 }
 #endif
 
@@ -35,7 +39,11 @@ int __kernel_gettimeofday(struct timeval *tv, struct 
timezone *tz)
 __attribute__((__visibility__("default")))
 int __kernel_clock_gettime(clockid_t clk_id, struct timespec *tp)
 {
-    return clock_gettime(clk_id, tp);
+    if (clock_gettime(clk_id, tp) < 0) {
+        return -errno;
+    } else {
+        return 0;
+    }
 }
 
 __attribute__((__visibility__("default")))

-- 
You received this message because you are subscribed to the Google Groups "OSv 
Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/osv-dev/0000000000003f99d1060c908218%40google.com.

Reply via email to