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

Comparing projects/libstatgrab/src/libstatgrab/disk_stats.c (file contents):
Revision 1.43 by tdb, Thu Nov 20 12:13:12 2003 UTC vs.
Revision 1.49 by tdb, Mon Jan 19 16:49:21 2004 UTC

# Line 1 | Line 1
1 < /*
1 > /*
2   * i-scream central monitoring system
3   * http://www.i-scream.org
4 < * Copyright (C) 2000-2003 i-scream
4 > * Copyright (C) 2000-2004 i-scream
5   *
6 < * This program is free software; you can redistribute it and/or
7 < * modify it under the terms of the GNU General Public License
8 < * as published by the Free Software Foundation; either version 2
9 < * of the License, or (at your option) any later version.
6 > * This library is free software; you can redistribute it and/or
7 > * modify it under the terms of the GNU Lesser General Public
8 > * License as published by the Free Software Foundation; either
9 > * version 2.1 of the License, or (at your option) any later version.
10   *
11 < * This program is distributed in the hope that it will be useful,
11 > * This library is distributed in the hope that it will be useful,
12   * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 < * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 < * GNU General Public License for more details.
13 > * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 > * Lesser General Public License for more details.
15   *
16 < * You should have received a copy of the GNU General Public License
17 < * along with this program; if not, write to the Free Software
18 < * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
16 > * You should have received a copy of the GNU Lesser General Public
17 > * License along with this library; if not, write to the Free Software
18 > * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
19 > * 02111-1307 USA
20 > *
21 > * $Id$
22   */
23  
24   #ifdef HAVE_CONFIG_H
# Line 576 | Line 579 | diskio_stat_t *get_diskio_stats(int *entries){
579                  n++;
580          }
581  
582 +        fclose(f);
583 +        f = NULL;
584 +
585          if (!has_pp_stats) {
586 <                /* This is an older kernel without stats in /proc/partitions.
587 <                   Read what we can from /proc/stat instead. */
586 >                /* This is an older kernel where /proc/partitions doesn't
587 >                   contain stats. Read what we can from /proc/stat instead, and
588 >                   fill in the appropriate bits of the list allocated above. */
589  
590                  f = fopen("/proc/stat", "r");
591                  if (f == NULL) goto out;
# Line 690 | Line 697 | diskio_stat_t *get_diskio_stats_diff(int *entries){
697          }
698  
699          diskio_stats_ptr=get_diskio_stats(&disks);
700 +        if (diskio_stats_ptr == NULL) {
701 +                return NULL;
702 +        }
703          diskio_stats_diff_ptr=diskio_stats_diff;
704  
705          for(x=0;x<sizeof_diskio_stats_diff;x++){

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines