This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]