From ee70fe7e1487f4047313f87555bd496f97719093 Mon Sep 17 00:00:00 2001 From: Michal Privoznik Date: Fri, 25 Mar 2016 10:20:28 +0100 Subject: [PATCH] virTestSetEnvPath: Avoid clearing out PATH If the abs_builddir path already is in PATH and it's in the first position, due to a bug in our code PATH would be cleared out. Signed-off-by: Michal Privoznik --- tests/testutils.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/testutils.c b/tests/testutils.c index d6cd1936d0..fc4c339bb7 100644 --- a/tests/testutils.c +++ b/tests/testutils.c @@ -822,7 +822,8 @@ virTestSetEnvPath(void) goto cleanup; } - if (setenv("PATH", new_path, 1) < 0) + if (new_path && + setenv("PATH", new_path, 1) < 0) goto cleanup; ret = 0;