diff options
| author | Zac Pierson <zacpiersonhehe@gmail.com> | 2017-02-08 11:59:54 -0600 |
|---|---|---|
| committer | Zac Pierson <zacpiersonhehe@gmail.com> | 2017-02-08 11:59:54 -0600 |
| commit | 7f6b83d50c0d9d7e2fefb189f1ce8a199c6bb561 (patch) | |
| tree | 195965dd42bf615bfcaea02be72f7703c481ac52 | |
| parent | 72d4bfb32aae5890cbf60d7d2f038ece098e31dc (diff) | |
Fixed gb.h - the file handle for /proc/cpuinfo is needed to read chars.
| -rw-r--r-- | src/gb/gb.h | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/gb/gb.h b/src/gb/gb.h index 9f9e850fc..1619914d6 100644 --- a/src/gb/gb.h +++ b/src/gb/gb.h @@ -5012,7 +5012,10 @@ void gb_affinity_init(gbAffinity *a) { // Parsing /proc/cpuinfo to get the number of threads per core. // NOTE(zangent): This calls the CPU's threads "cores", although the wording // is kind of weird. This should be right, though. - if (fopen("/proc/cpuinfo", "r") != NULL) { + + FILE* cpu_info = fopen("/proc/cpuinfo", "r"); + + if (cpu_info != NULL) { for (;;) { // The 'temporary char'. Everything goes into this char, // so that we can check against EOF at the end of this loop. @@ -5043,6 +5046,7 @@ void gb_affinity_init(gbAffinity *a) { } #undef AF__CHECK } + fclose(cpu_info); } if (threads == 0) { |