[lvm-devel] master - dmfilemapd: use *argv[0] when testing for absolute path (coverity)

Bryn Reeves bmr at sourceware.org
Wed Mar 29 20:16:10 UTC 2017


Gitweb:        https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=43fdbb8aeb78f9ada5dc135fa421c344c8e998d3
Commit:        43fdbb8aeb78f9ada5dc135fa421c344c8e998d3
Parent:        b5252a51a5d041a94e712d804a506e94c9a68893
Author:        Bryn M. Reeves <bmr at redhat.com>
AuthorDate:    Wed Mar 29 17:03:20 2017 +0100
Committer:     Bryn M. Reeves <bmr at redhat.com>
CommitterDate: Wed Mar 29 18:33:42 2017 +0100

dmfilemapd: use *argv[0] when testing for absolute path (coverity)

The path argument check in dmfilemapd incorrectly tests for:

  if (argv[0] == '/')

Rather than testing the 1st character in the string pointed to by
argv[0].
---
 daemons/dmfilemapd/dmfilemapd.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/daemons/dmfilemapd/dmfilemapd.c b/daemons/dmfilemapd/dmfilemapd.c
index fae6a10..0cb0ad7 100644
--- a/daemons/dmfilemapd/dmfilemapd.c
+++ b/daemons/dmfilemapd/dmfilemapd.c
@@ -305,7 +305,7 @@ static int _parse_args(int argc, char **argv, struct filemap_monitor *fm)
 		return 0;
 	}
 
-	if (argv[0] != '/') {
+	if (*argv[0] != '/') {
 		_early_log("Path argument must specify an absolute path.");
 		return 0;
 	}




More information about the lvm-devel mailing list