tiny rewrite, typefix, don't compare EOF with a char
This commit is contained in:
parent
2bbacac418
commit
87a7aec46b
|
|
@ -1,3 +1,7 @@
|
||||||
|
2011-06-23 Robert Larice
|
||||||
|
* src/frontend/com_sysinfo.c :
|
||||||
|
tiny rewrite, typefix, don't compare EOF with a char
|
||||||
|
|
||||||
2011-06-23 Holger Vogt
|
2011-06-23 Holger Vogt
|
||||||
* measure.c: another try to obtain correct vector handling
|
* measure.c: another try to obtain correct vector handling
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -214,17 +214,14 @@ TesError tesCreateSystemInfo(TesSystemInfo *info) {
|
||||||
/* get kernel version string */
|
/* get kernel version string */
|
||||||
file = fopen("/proc/version", "rb");
|
file = fopen("/proc/version", "rb");
|
||||||
if(file != NULL) {
|
if(file != NULL) {
|
||||||
tInt size = 0;
|
size_t size;
|
||||||
char buf;
|
|
||||||
|
|
||||||
/* read bytes and find end of file */
|
/* read bytes and find end of file */
|
||||||
buf = fgetc(file);
|
for(size=0; ; size++)
|
||||||
while(buf != EOF) {
|
if(EOF == fgetc(file))
|
||||||
size++;
|
break;
|
||||||
buf = fgetc(file);
|
|
||||||
}
|
|
||||||
|
|
||||||
info->osName = (char*) malloc((size) * sizeof(char));
|
info->osName = (char*) malloc(size * sizeof(char));
|
||||||
rewind(file);
|
rewind(file);
|
||||||
fread(info->osName, sizeof(char), size, file);
|
fread(info->osName, sizeof(char), size, file);
|
||||||
fclose(file);
|
fclose(file);
|
||||||
|
|
@ -238,15 +235,14 @@ TesError tesCreateSystemInfo(TesSystemInfo *info) {
|
||||||
/* get cpu information */
|
/* get cpu information */
|
||||||
file = fopen("/proc/cpuinfo", "rb");
|
file = fopen("/proc/cpuinfo", "rb");
|
||||||
if(file != NULL) {
|
if(file != NULL) {
|
||||||
tInt size = 0;
|
size_t size;
|
||||||
char buf, *inStr;
|
char *inStr;
|
||||||
|
|
||||||
/* read bytes and find end of file */
|
/* read bytes and find end of file */
|
||||||
buf = fgetc(file);
|
for(size=0; ; size++)
|
||||||
while(buf != EOF) {
|
if(EOF == fgetc(file))
|
||||||
size++;
|
break;
|
||||||
buf = fgetc(file);
|
|
||||||
}
|
|
||||||
/* get complete string */
|
/* get complete string */
|
||||||
inStr = (char*) malloc((size+1) * sizeof(char));
|
inStr = (char*) malloc((size+1) * sizeof(char));
|
||||||
rewind(file);
|
rewind(file);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue