Skip to contentSkip to conversation

[6517] Properly initialize len argument of sysctl and include stdio.h ( perror)

Qemu-devel malc 1 participant 1 message Feb 4, 2009

lore
Share & tools
lore

malc

author
#0 lore raw

Revision: 6517

          http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=6517
Author:   malc
Date:     2009-02-04 20:39:09 +0000 (Wed, 04 Feb 2009)

Log Message:
-----------
Properly initialize len argument of sysctl and include stdio.h (perror)

Modified Paths:
--------------
trunk/cache-utils.c

Modified: trunk/cache-utils.c
===================================================================

cache-utils.c +2 -0
@@ -37,6 +37,7 @@
 }
 
 #elif defined __APPLE__
+#include <stdio.h>
 #include <sys/types.h>
 #include <sys/sysctl.h>
 
@@ -46,6 +47,7 @@
     unsigned cacheline;
     int name[2] = { CTL_HW, HW_CACHELINE };
 
+    len = sizeof(cacheline);
     if (sysctl(name, 2, &cacheline, &len, NULL, 0)) {
         perror("sysctl CTL_HW HW_CACHELINE failed");
     } else {