@@ -543,7 +543,6 @@ load_config (char * file, struct udev *udev)
conf->verbosity = DEFAULT_VERBOSITY;
conf->udev = udev;
- dm_drv_version(conf->version, TGT_MPATH);
conf->dev_type = DEV_NONE;
conf->minio = DEFAULT_MINIO;
conf->minio_rq = DEFAULT_MINIO_RQ;
@@ -428,16 +428,8 @@ main (int argc, char *argv[])
extern int optind;
int r = 1;
- if (getuid() != 0) {
- fprintf(stderr, "need to be root\n");
- exit(1);
- }
-
udev = udev_new();
- if (dm_prereq())
- exit(1);
-
if (load_config(DEFAULT_CONFIGFILE, udev))
exit(1);
@@ -502,7 +494,7 @@ main (int argc, char *argv[])
break;
case 't':
r = dump_config();
- goto out;
+ goto out_free_config;
case 'h':
usage(argv[0]);
exit(0);
@@ -525,6 +517,16 @@ main (int argc, char *argv[])
exit(1);
}
}
+
+ if (getuid() != 0) {
+ fprintf(stderr, "need to be root\n");
+ exit(1);
+ }
+
+ if (dm_prereq())
+ exit(1);
+ dm_drv_version(conf->version, TGT_MPATH);
+
if (optind < argc) {
conf->dev = MALLOC(FILE_NAME_SIZE);
@@ -609,6 +611,8 @@ out:
cleanup_prio();
cleanup_checkers();
+
+out_free_config:
/*
* Freeing config must be done after dm_lib_exit(), because
* the logging function (dm_write_log()), which is called there,
@@ -1457,6 +1457,7 @@ reconfigure (struct vectors * vecs)
tzset();
if (!load_config(DEFAULT_CONFIGFILE, udev)) {
+ dm_drv_version(conf->version, TGT_MPATH);
conf->verbosity = old->verbosity;
conf->daemon = 1;
configure(vecs, 1);
@@ -1682,6 +1683,7 @@ child (void * param)
if (load_config(DEFAULT_CONFIGFILE, udev))
goto failed;
+ dm_drv_version(conf->version, TGT_MPATH);
if (init_checkers()) {
condlog(0, "failed to initialize checkers");
goto failed;
'multipath -t' should be run as normal user, as we might be needing it to update the default configuration. Signed-off-by: Hannes Reinecke <hare@suse.de> --- libmultipath/config.c | 1 - multipath/main.c | 22 +++++++++++++--------- multipathd/main.c | 2 ++ 3 files changed, 15 insertions(+), 10 deletions(-)