Imported Upstream version 2.6.0
[debian/amanda] / server-src / amindex.c
index 6e50fe5a1b369c0fd13e550cc94bbe12500e808d..7c52bd380564043709666ffa4f51a23dbc93f03c 100644 (file)
@@ -25,7 +25,7 @@
  *                        University of Maryland at College Park
  */
 /*
- * $Id: amindex.c,v 1.15.2.1 2006/11/24 18:05:05 martinea Exp $
+ * $Id: amindex.c,v 1.15 2006/05/25 01:47:19 johnfranks Exp $
  *
  * index control
  */
@@ -64,7 +64,7 @@ getindexfname(
     datebuf[SIZEOF(datebuf)-1] = '\0';
     dc = datebuf;
 
-    snprintf(level_str, SIZEOF(level_str), "%d", level);
+    g_snprintf(level_str, SIZEOF(level_str), "%d", level);
   }
 
   host = sanitise_filename(host);
@@ -72,12 +72,7 @@ getindexfname(
     disk = sanitise_filename(disk);
   }
 
-  conf_indexdir = getconf_str(CNF_INDEXDIR);
-  if (*conf_indexdir == '/') {
-    conf_indexdir = stralloc(conf_indexdir);
-  } else {
-    conf_indexdir = stralloc2(config_dir, conf_indexdir);
-  }
+  conf_indexdir = config_dir_relative(getconf_str(CNF_INDEXDIR));
   /*
    * Note: vstralloc() will stop at the first NULL, which might be
    * "disk" or "dc" (datebuf) rather than the full file name.
@@ -126,7 +121,7 @@ getoldindexfname(
     datebuf[SIZEOF(datebuf)-1] = '\0';
     dc = datebuf;
 
-    snprintf(level_str, SIZEOF(level_str), "%d", level);
+    g_snprintf(level_str, SIZEOF(level_str), "%d", level);
   }
 
   host = old_sanitise_filename(host);
@@ -134,12 +129,7 @@ getoldindexfname(
     disk = old_sanitise_filename(disk);
   }
 
-  conf_indexdir = getconf_str(CNF_INDEXDIR);
-  if (*conf_indexdir == '/') {
-    conf_indexdir = stralloc(conf_indexdir);
-  } else {
-    conf_indexdir = stralloc2(config_dir, conf_indexdir);
-  }
+  conf_indexdir = config_dir_relative(getconf_str(CNF_INDEXDIR));
   /*
    * Note: vstralloc() will stop at the first NULL, which might be
    * "disk" or "dc" (datebuf) rather than the full file name.