* progress in moving all the fileaccess over to a wrapper system that can do fd based...
[rrdtool.git] / src / rrd_info.c
index aa1fe42..2160962 100644 (file)
@@ -1,5 +1,5 @@
 /*****************************************************************************
- * RRDtool 1.2rc7  Copyright by Tobi Oetiker, 1997-2005
+ * RRDtool 1.2.23  Copyright by Tobi Oetiker, 1997-2007
  *****************************************************************************
  * rrd_info  Get Information about the configuration of an RRD
  *****************************************************************************/
@@ -83,17 +83,18 @@ rrd_info(int argc, char **argv) {
 info_t *
 rrd_info_r(char *filename) {   
     unsigned int i,ii=0;
-    FILE         *in_file;
     rrd_t        rrd;
     info_t       *data,*cd;
     infoval      info;
+    rrd_file_t*  rrd_file;
        enum cf_en   current_cf;
        enum dst_en  current_ds;
 
-    if(rrd_open(filename,&in_file,&rrd, RRD_READONLY)==-1){
+    rrd_file = rrd_open(filename,&rrd, RRD_READONLY);
+    if (rrd_file == NULL) {
        return(NULL);
     }
-    fclose(in_file);
+    close(rrd_file->fd);
 
     info.u_str=filename;
     cd=info_push(NULL,sprintf_alloc("filename"),    RD_I_STR, info);
@@ -117,7 +118,7 @@ rrd_info_r(char *filename) {
     switch (current_ds) {
           case DST_CDEF:
                  {
-                 char *buffer = 0;
+                 char *buffer = NULL;
                  rpn_compact2str((rpn_cdefds_t *) &(rrd.ds_def[i].par[DS_cdef]),
                         rrd.ds_def, &buffer);
                  info.u_str = buffer;
@@ -233,6 +234,7 @@ rrd_info_r(char *filename) {
     }
        }
        rrd_free(&rrd);
+    rrd_close(rrd_file);
     return(data);
 
 }