From: Nathan F. <nf...@au...> - 2010-01-06 19:47:13
|
The check to determine if cpu dlpar is capable on a system has a flaw, namely that a similarly named file can cause a failure. The capable check looks for the online file in the /sys/devices/system/cpu/cpuX directory, where X is a number. This checked fails on newer kernels that present a cpufreq directory that does not (nor should) contain an online file. The simple fix is to ensure that the directory we check starts with 'cpu' and is followed by a digit. Signed-off-by: Nathan Fontenot <nf...@au...> --- Index: powerpc-utils/src/drmgr/common.c =================================================================== --- powerpc-utils.orig/src/drmgr/common.c 2010-01-05 12:57:34.000000000 -0600 +++ powerpc-utils/src/drmgr/common.c 2010-01-05 16:08:57.000000000 -0600 @@ -15,6 +15,7 @@ #include <errno.h> #include <dirent.h> #include <execinfo.h> +#include <ctype.h> #include "dr.h" #include "ofdt.h" @@ -1026,6 +1027,12 @@ if (strncmp(de->d_name, "cpu", 3)) continue; + /* Ensure this is a cpu directory, i.e. cpu0, and not a + * non-cpu directory, i.e. cpufreq + */ + if (!isdigit(de->d_name[3])) + continue; + sprintf(fname, "%s/%s/online", cpu_dir, de->d_name); if (stat(fname, &sbuf)) { |