lvm2/6043-cov-clearer-condition-check.patch

32 lines
937 B
Diff
Raw Normal View History

2019-12-29 15:13:59 +08:00
From 8bea252a636ff0de2266c1ce760b3a6047f0ff2f Mon Sep 17 00:00:00 2001
From: Zdenek Kabelac <zkabelac@redhat.com>
Date: Tue, 25 Jun 2019 15:08:10 +0200
Subject: [PATCH] cov: clearer condition check
Make the code more obvious.
---
lib/activate/activate.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/lib/activate/activate.c b/lib/activate/activate.c
index b3b8a25..561a965 100644
--- a/lib/activate/activate.c
+++ b/lib/activate/activate.c
@@ -2478,7 +2478,12 @@ static int _lv_resume(struct cmd_context *cmd, const char *lvid_s,
* If vg_commit() did not happen, lvmcache_get_saved_vg_latest
* returns the old metadata which we use to resume LVs.
*/
- if (!lv && lvid_s) {
+ if (!lv) {
+ if (!lvid_s) {
+ log_error(INTERNAL_ERROR "Requested resume of unindentified resource!");
+ return 0;
+ }
+
lvid = (const union lvid *) lvid_s;
vgid = (const char *)lvid->id[0].uuid;
--
1.8.3.1