Skip to content

Commit ffdd5ed

Browse files
eaibmzmetan-ucw
authored andcommitted
lib/tst_virt: fix detection when systemd-detect-virt returns 1
When systemd-detect-virt detects no virtualization environment, it returns 1 as exit code. This leads to tst_is_virt not doing any fallback tests. The problem can be reproduced inside a IBM System Z LPAR virtualization environment. Signed-off-by: Alexander Egorenkov <[email protected]> Reviewed-by: Cyril Hrubis <[email protected]>
1 parent 31708e8 commit ffdd5ed

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/tst_virt.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,9 @@ int tst_is_virt(int virt_type)
109109
{
110110
int ret = try_systemd_detect_virt();
111111

112-
if (ret >= 0) {
112+
if (ret > 0) {
113113
if (virt_type == VIRT_ANY)
114-
return ret != 0;
114+
return 1;
115115
else
116116
return ret == virt_type;
117117
}

0 commit comments

Comments
 (0)