[lvm-devel] master - coverity: ensure lock_type is not NULL
Zdenek Kabelac
zkabelac at sourceware.org
Sat Mar 17 22:34:41 UTC 2018
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=f331eb1c0d060529a3b5e6517c8ac423e21796d3
Commit: f331eb1c0d060529a3b5e6517c8ac423e21796d3
Parent: fd6661dfcf7568d32a127e63b0d6c95c010688fb
Author: Zdenek Kabelac <zkabelac at redhat.com>
AuthorDate: Sat Mar 17 14:16:09 2018 +0100
Committer: Zdenek Kabelac <zkabelac at redhat.com>
CommitterDate: Sat Mar 17 23:33:58 2018 +0100
coverity: ensure lock_type is not NULL
---
tools/vgchange.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/vgchange.c b/tools/vgchange.c
index 6d739fe..7cfaab6 100644
--- a/tools/vgchange.c
+++ b/tools/vgchange.c
@@ -955,7 +955,7 @@ static int _vgchange_locktype(struct cmd_context *cmd, struct volume_group *vg)
vg->lock_type = "none";
}
- if (!strcmp(vg->lock_type, lock_type)) {
+ if (lock_type && !strcmp(vg->lock_type, lock_type)) {
log_warn("New lock type %s matches the current lock type %s.",
lock_type, vg->lock_type);
return 1;
@@ -1180,7 +1180,7 @@ int vgchange_locktype_cmd(struct cmd_context *cmd, int argc, char **argv)
* just return success when they see the disable flag set.
*/
if (lockopt && !strcmp(lockopt, "force")) {
- if (strcmp(lock_type, "none")) {
+ if (lock_type && strcmp(lock_type, "none")) {
log_error("Lock type can only be forced to \"none\" for recovery.");
return 0;
}
More information about the lvm-devel
mailing list