Fix: some type magic hopefully also functions on 64bit systems
authorSven-Ola Tuecke <sven-ola@gmx.de>
Thu, 8 Jan 2009 08:54:14 +0000 (09:54 +0100)
committerSven-Ola Tuecke <sven-ola@gmx.de>
Thu, 8 Jan 2009 08:54:14 +0000 (09:54 +0100)
src/main.c

index e9c2706..2321687 100644 (file)
@@ -845,8 +845,8 @@ unsigned long
 olsr_times(void)
 {
   struct tms tms_buf;
-  const long t = times(&tms_buf);
-  return -1 == t ? -errno : (t & 0x7fffffff);
+  const unsigned long t = (unsigned long)times(&tms_buf);
+  return (unsigned long)-1 == t ? (unsigned long)-errno : (t & ((unsigned long)-1 >> 1));
 }
 
 /*