[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [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 <mprivozn redhat com>
---

Pushed under trivial rule.

 tests/testutils.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tests/testutils.c b/tests/testutils.c
index d6cd193..fc4c339 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;
-- 
2.7.3


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]