Fixed #261. Use strncmp instead of a comparing trick.

This commit is contained in:
Zhang Xianyi 2013-07-26 23:43:54 +08:00
parent 63f14189e3
commit 4471c77905
1 changed files with 2 additions and 1 deletions

View File

@ -83,6 +83,7 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <dirent.h> #include <dirent.h>
#include <dlfcn.h> #include <dlfcn.h>
#include <unistd.h> #include <unistd.h>
#include <string.h>
#define MAX_NODES 16 #define MAX_NODES 16
#define MAX_CPUS 256 #define MAX_CPUS 256
@ -315,7 +316,7 @@ static int numa_check(void) {
} }
while ((dir = readdir(dp)) != NULL) { while ((dir = readdir(dp)) != NULL) {
if (*(unsigned int *) dir -> d_name == 0x065646f6eU) { if (strncmp(dir->d_name, "node", 4)==0) {
node = atoi(&dir -> d_name[4]); node = atoi(&dir -> d_name[4]);