e354a5
commit da2b83ef6ba6f4c974664f69e715cc85b9173938
e354a5
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
e354a5
Date:   Mon May 13 13:13:46 2019 -0300
e354a5
e354a5
    elf: Fix tst-pldd for non-default --prefix and/or --bindir (BZ#24544)
e354a5
    
e354a5
    Use a new libsupport support_bindir_prefix instead of a hardcoded
e354a5
    /usr/bin to create the pldd path on container directory.
e354a5
    
e354a5
    Checked on x86_64-linux-gnu with default and non-default --prefix and
e354a5
    --bindir paths, as well with --enable-hardcoded-path-in-tests.
e354a5
    
e354a5
            [BZ #24544]
e354a5
            * elf/tst-pldd.c (do_test): Use support_bindir_prefix instead of
e354a5
            pre-defined value.
e354a5
    
e354a5
    Reviewed-by: DJ Delorie <dj@redhat.com>
e354a5
e354a5
diff --git a/elf/tst-pldd.c b/elf/tst-pldd.c
e354a5
index 40abee9efb9e7484..e2de31282a131166 100644
e354a5
--- a/elf/tst-pldd.c
e354a5
+++ b/elf/tst-pldd.c
e354a5
@@ -18,6 +18,7 @@
e354a5
 
e354a5
 #include <stdio.h>
e354a5
 #include <string.h>
e354a5
+#include <stdlib.h>
e354a5
 #include <unistd.h>
e354a5
 #include <stdint.h>
e354a5
 #include <stdbool.h>
e354a5
@@ -28,6 +29,7 @@
e354a5
 #include <support/subprocess.h>
e354a5
 #include <support/capture_subprocess.h>
e354a5
 #include <support/check.h>
e354a5
+#include <support/support.h>
e354a5
 
e354a5
 static void
e354a5
 target_process (void *arg)
e354a5
@@ -60,12 +62,14 @@ do_test (void)
e354a5
     char pid[3 * sizeof (uint32_t) + 1];
e354a5
     snprintf (pid, array_length (pid), "%d", target.pid);
e354a5
 
e354a5
-    const char prog[] = "/usr/bin/pldd";
e354a5
+    char *prog = xasprintf ("%s/pldd", support_bindir_prefix);
e354a5
 
e354a5
     pldd = support_capture_subprogram (prog,
e354a5
       (char *const []) { (char *) prog, pid, NULL });
e354a5
 
e354a5
     support_capture_subprocess_check (&pldd, "pldd", 0, sc_allow_stdout);
e354a5
+
e354a5
+    free (prog);
e354a5
   }
e354a5
 
e354a5
   /* Check 'pldd' output.  The test is expected to be linked against only