]> xenbits.xensource.com Git - libvirt.git/commitdiff
virTestSetEnvPath: Avoid clearing out PATH
authorMichal Privoznik <mprivozn@redhat.com>
Fri, 25 Mar 2016 09:20:28 +0000 (10:20 +0100)
committerMichal Privoznik <mprivozn@redhat.com>
Fri, 25 Mar 2016 09:20:28 +0000 (10:20 +0100)
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>
tests/testutils.c

index d6cd1936d0fb0a903de184784ac33a72e82337bd..fc4c339bb7fe9e7c9024a63dbebce88e8c01d62b 100644 (file)
@@ -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;