--- projects/cms/source/ihost/libstatgrab/load_stat.c 2002/05/12 19:10:55 1.1 +++ projects/cms/source/ihost/libstatgrab/load_stat.c 2002/05/13 12:51:26 1.3 @@ -2,7 +2,7 @@ #include #include "ukcprog.h" -char* get_load_stats(){ +char *get_load_stats(){ double loadav[3]; char *xml_load_out; @@ -18,7 +18,10 @@ char* get_load_stats(){ return NULL; } - fscanf(f,"%lf %lf %lf", &loadav[0], &loadav[1], &loadav[2]); + if((fscanf(f,"%lf %lf %lf", &loadav[0], &loadav[1], &loadav[2])) != 3){ + errf("Failed to read in sufficent loads"); + return NULL; + } if ((fclose(f)) != 0) { errf("Failed to close file (%m)."); @@ -30,7 +33,7 @@ char* get_load_stats(){ } #endif - xml_load_out=strf("%.2lf%.2lf%.2lf\n", loadav[0], loadav[1], loadav[2]); + xml_load_out=strf("%.2lf%.2lf%.2lf", loadav[0], loadav[1], loadav[2]); return xml_load_out; }