[lvm-devel] master - dmsetup: cleanup warn for older compilers

Zdenek Kabelac zkabelac at fedoraproject.org
Mon Nov 9 11:29:05 UTC 2015


Gitweb:        http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=84a954686903b705eb0733a1bc02a7ac66728779
Commit:        84a954686903b705eb0733a1bc02a7ac66728779
Parent:        5aae8de7760e321ad1fd6e88128379640df31c29
Author:        Zdenek Kabelac <zkabelac at redhat.com>
AuthorDate:    Mon Nov 9 10:48:40 2015 +0100
Committer:     Zdenek Kabelac <zkabelac at redhat.com>
CommitterDate: Mon Nov 9 12:21:17 2015 +0100

dmsetup: cleanup warn for older compilers

Older gcc somehow thinks there is a path of using
subcommand uninitilized.

So make it more obvious there is no such one.
---
 tools/dmsetup.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/tools/dmsetup.c b/tools/dmsetup.c
index 15bff64..bfba753 100644
--- a/tools/dmsetup.c
+++ b/tools/dmsetup.c
@@ -6132,7 +6132,7 @@ int main(int argc, char **argv)
 	int ret = 1, r;
 	const char *dev_dir;
 	const struct command *cmd;
-	const char *subcommand;
+	const char *subcommand = "";
 	int multiple_devices;
 
 	(void) setlocale(LC_ALL, "");
@@ -6227,8 +6227,7 @@ unknown:
 	if (cmd->has_subcommands) {
 		subcommand = argv[0];
 		argc--, argv++;
-	} else
-		subcommand = "";
+	}
 
 	if (_switches[COLS_ARG] && !_report_init(cmd, subcommand))
 		goto_out;




More information about the lvm-devel mailing list