[BZ 24544] Use support_install_prefix in elf/tst-pldd.c

Carlos O'Donell codonell@redhat.com
Mon May 13 15:43:00 GMT 2019


On 5/10/19 8:29 AM, Adhemerval Zanella wrote:
>> -    const char prog[] = "/usr/bin/pldd";
>> +    char prog[PATH_MAX] = "";
>> +    strcpy(prog, support_install_prefix);
>> +    strcat(prog, "/bin/pldd");
> 
> Use snprintf instead (there is no need to actually initialize 
> prog as well):
> 
>   snprintf (prog, sizeof prog, "%s/bin/pldd", support_install_prefix) 
> 
> LGTM with the change.

This won't work.

Users can configure --prefix, and --bindir, so you have to abstract
this up a level:

* support/Makefile (CFLAGS-support_paths.c): Define -DBINDIR_PATH=\"$(bindir)\"
* support/support_paths.h (support_install_bindir): Define as BINDIR_PATH
* Use support_install_bindir to set pldd's path.
  snprintf (prog, sizeof prog, "%s/pldd", support_install_bindir)

We'll eventually need one of each kind of variable for all the places
binaries are installed because we want to test each of them in a
container under test conditions.

-- 
Cheers,
Carlos.



More information about the Libc-alpha mailing list