Imported Upstream version 2.6.1
[debian/amanda] / server-src / amcleanupdisk.c
index a67154cbbf5657db027e1334de3f62e2558b2e15..95dd3d377659714614137fbcbdc74770b83b5c4e 100644 (file)
 
 /* Utility funcitons */
 
-/* Call open_diskfile() with the diskfile from the configuration
- */
-static void
-init_diskfile(void)
-{
-    char *conf_diskfile = config_dir_relative(getconf_str(CNF_DISKFILE));
-    disklist_t diskq; /* never used, but required by read_diskfile */
-
-    if (read_diskfile(conf_diskfile, &diskq) < 0) {
-       error(_("could not load disklist %s"), conf_diskfile);
-       /*NOTREACHED*/
-    }
-    amfree(conf_diskfile);
-}
-
 /* Call open_infofile() with the infofile from the configuration
  */
 static void
@@ -98,6 +83,8 @@ main(
 {
     FILE *verbose_output = NULL;
     char *cfg_opt = NULL;
+    char *conf_diskfile;
+    disklist_t diskq;
 
     /*
      * Configure program for internationalization:
@@ -128,14 +115,25 @@ main(
        cfg_opt = argv[1];
     }
 
-    config_init(CONFIG_INIT_EXPLICIT_NAME | CONFIG_INIT_FATAL,
+    config_init(CONFIG_INIT_EXPLICIT_NAME,
                cfg_opt);
 
+    conf_diskfile = config_dir_relative(getconf_str(CNF_DISKFILE));
+    read_diskfile(conf_diskfile, &diskq);
+    /* diskq also ends up in a global, used by holding_cleanup */
+    amfree(conf_diskfile);
+
+    if (config_errors(NULL) >= CFGERR_WARNINGS) {
+       config_print_errors();
+       if (config_errors(NULL) >= CFGERR_ERRORS) {
+           g_critical(_("errors processing config file"));
+       }
+    }
+
     check_running_as(RUNNING_AS_DUMPUSER);
 
-    dbrename(config_name, DBG_SUBDIR_SERVER);
+    dbrename(get_config_name(), DBG_SUBDIR_SERVER);
 
-    init_diskfile();
     init_infofile();
 
     /* actually perform the cleanup */