576 |
|
n++; |
577 |
|
} |
578 |
|
|
579 |
< |
if(f != NULL) fclose(f); |
579 |
> |
fclose(f); |
580 |
> |
f = NULL; |
581 |
|
|
581 |
– |
/* This code relies on /proc/partions existing, and it all being malloc'ed above. |
582 |
– |
|
582 |
|
if (!has_pp_stats) { |
583 |
< |
/* This is an older kernel without stats in /proc/partitions. |
584 |
< |
Read what we can from /proc/stat instead. */ |
583 |
> |
/* This is an older kernel where /proc/partitions doesn't |
584 |
> |
contain stats. Read what we can from /proc/stat instead, and |
585 |
> |
fill in the appropriate bits of the list allocated above. */ |
586 |
|
|
587 |
|
f = fopen("/proc/stat", "r"); |
588 |
|
if (f == NULL) goto out; |
694 |
|
} |
695 |
|
|
696 |
|
diskio_stats_ptr=get_diskio_stats(&disks); |
697 |
+ |
if (diskio_stats_ptr == NULL) { |
698 |
+ |
return NULL; |
699 |
+ |
} |
700 |
|
diskio_stats_diff_ptr=diskio_stats_diff; |
701 |
|
|
702 |
|
for(x=0;x<sizeof_diskio_stats_diff;x++){ |