Fix some leaking file handles and buildfix probably.

This commit is contained in:
Jordan Woyak
2013-03-03 19:18:04 -06:00
parent 989f0663eb
commit 814c2ffdfd
3 changed files with 11 additions and 10 deletions

View File

@ -18,6 +18,7 @@
#include "Common.h"
#include "CPUDetect.h"
#include "StringUtil.h"
#include "FileUtil.h"
const char procfile[] = "/proc/cpuinfo";
@ -27,9 +28,9 @@ char *GetCPUString()
char *cpu_string = 0;
// Count the number of processor lines in /proc/cpuinfo
char buf[1024];
FILE *fp;
fp = fopen(procfile, "r");
File::IOFile file(procfile, "r");
auto const fp = file.GetHandle();
if (!fp)
return 0;
@ -47,9 +48,9 @@ bool CheckCPUFeature(const char *feature)
{
const char marker[] = "Features\t: ";
char buf[1024];
FILE *fp;
fp = fopen(procfile, "r");
File::IOFile file(procfile, "r");
auto const fp = file.GetHandle();
if (!fp)
return 0;
@ -73,9 +74,9 @@ int GetCoreCount()
const char marker[] = "processor\t: ";
int cores = 0;
char buf[1024];
FILE *fp;
fp = fopen(procfile, "r");
File::IOFile file(procfile, "r");
auto const fp = file.GetHandle();
if (!fp)
return 0;