ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/cms/source/ihost/libstatgrab/load_stat.c
(Generate patch)

Comparing projects/cms/source/ihost/libstatgrab/load_stat.c (file contents):
Revision 1.1 by pajs, Sun May 12 19:10:55 2002 UTC vs.
Revision 1.3 by pajs, Mon May 13 12:51:26 2002 UTC

# Line 2 | Line 2
2   #include <stdlib.h>
3   #include "ukcprog.h"
4  
5 < char* get_load_stats(){
5 > char *get_load_stats(){
6  
7          double loadav[3];
8          char *xml_load_out;
# Line 18 | Line 18 | char* get_load_stats(){
18                  return NULL;
19          }
20  
21 <        fscanf(f,"%lf %lf %lf", &loadav[0], &loadav[1], &loadav[2]);
21 >        if((fscanf(f,"%lf %lf %lf", &loadav[0], &loadav[1], &loadav[2])) != 3){
22 >                errf("Failed to read in sufficent loads");
23 >                return NULL;
24 >        }
25  
26          if ((fclose(f)) != 0) {
27                  errf("Failed to close file (%m).");
# Line 30 | Line 33 | char* get_load_stats(){
33          }
34   #endif
35  
36 <        xml_load_out=strf("<load><load1>%.2lf</load1><load5>%.2lf</load5><loag15>%.2lf</load15></load>\n", loadav[0], loadav[1], loadav[2]);
36 >        xml_load_out=strf("<load><load1>%.2lf</load1><load5>%.2lf</load5><loag15>%.2lf</load15></load>", loadav[0], loadav[1], loadav[2]);
37  
38          return xml_load_out;
39   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines