[K42-discussion] patch for trivial bug in times() "syscall"

Andrew Baumann andrewb at cse.unsw.edu.au
Mon Sep 12 14:52:07 EST 2005


Hi,

it seems that on Linux it is possible to call times(NULL). This patch emulates 
that behaviour.

Andrew

--- kitch-linux/lib/emu/times.C 14 Jun 2004 20:32:57 -0000      1.6
+++ kitch-linux/lib/emu/times.C 12 Sep 2005 04:07:29 -0000
@@ -42,7 +42,9 @@
     ret = now * CLK_TCK / tps;

     // FIXME: need to update buf
-    memset (buf, 0, sizeof (*buf));
+    if (buf != NULL) {
+        memset (buf, 0, sizeof (*buf));
+    }

     SYSCALL_EXIT();




More information about the K42-discussion mailing list