summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZdenek Kabelac <zkabelac@redhat.com>2019-05-03 13:01:02 +0200
committerZdenek Kabelac <zkabelac@redhat.com>2019-05-03 13:17:22 +0200
commita520b3002c2f31f84324d2f59dd1e156bc45ec65 (patch)
tree490d1602c4634726eca99acda0dd1ddf09904dc0
parent3c70ae1803b06dea68b2e6e1ec2176b3f3fe9707 (diff)
downloadlvm2-a520b3002c2f31f84324d2f59dd1e156bc45ec65.tar.gz
locking: validate locking mode
Ensure 'ret' is always defined and validate 'mode'.
-rw-r--r--lib/locking/locking.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/locking/locking.c b/lib/locking/locking.c
index fd2b9750f..630a3bc80 100644
--- a/lib/locking/locking.c
+++ b/lib/locking/locking.c
@@ -361,6 +361,9 @@ static int _lockf_global(struct cmd_context *cmd, const char *mode, int convert)
} else if (!strcmp(mode, "un")) {
ret = lock_vol(cmd, VG_GLOBAL, LCK_UNLOCK, NULL);
cmd->lockf_global_ex = 0;
+ } else {
+ log_error(INTERNAL_ERROR "Unknown locking mode %s.", mode);
+ return 0;
}
return ret;