Skip to content

Commit 4471c77

Browse files
committed
Fixed #261. Use strncmp instead of a comparing trick.
1 parent 63f1418 commit 4471c77

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

driver/others/init.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
8383
#include <dirent.h>
8484
#include <dlfcn.h>
8585
#include <unistd.h>
86+
#include <string.h>
8687

8788
#define MAX_NODES 16
8889
#define MAX_CPUS 256
@@ -315,7 +316,7 @@ static int numa_check(void) {
315316
}
316317

317318
while ((dir = readdir(dp)) != NULL) {
318-
if (*(unsigned int *) dir -> d_name == 0x065646f6eU) {
319+
if (strncmp(dir->d_name, "node", 4)==0) {
319320

320321
node = atoi(&dir -> d_name[4]);
321322

0 commit comments

Comments
 (0)