From 9dc3fc4dd474ce4da6a45dcf197e1f99a9a7047a Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Thu, 3 Jul 2014 19:30:02 +0300 Subject: [PATCH] Fix calculation of CPU set size for getaffinity. * libguile/posix.c (cpu_set_to_bitvector): Use CPU_SETSIZE, not sizeof, to compute the size of the CPU set. --- libguile/posix.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libguile/posix.c b/libguile/posix.c index 1dcb5acbb..7fc690305 100644 --- a/libguile/posix.c +++ b/libguile/posix.c @@ -1979,9 +1979,9 @@ cpu_set_to_bitvector (const cpu_set_t *cs) SCM bv; size_t cpu; - bv = scm_c_make_bitvector (sizeof (*cs), SCM_BOOL_F); + bv = scm_c_make_bitvector (CPU_SETSIZE, SCM_BOOL_F); - for (cpu = 0; cpu < sizeof (*cs); cpu++) + for (cpu = 0; cpu < CPU_SETSIZE; cpu++) { if (CPU_ISSET (cpu, cs)) /* XXX: This is inefficient but avoids code duplication. */