[Buildroot] [PATCH] pkgconf: make wrapper relocatable
Peter Korsgaard
peter at korsgaard.com
Wed Mar 9 15:06:48 UTC 2016
>>>>> "Arnout" == Arnout Vandecappelle <arnout at mind.be> writes:
Hi,
>> well, if executed throyh a shell it will - But if I write code to call
>> execve I get to chose what argv[0] should be.
> Read the section "Interpreter scripts" of execve(2). argv[0] is discarded.
Ahh yes, for a script this would be true because of the shebang handling
in the kernel, but it is not true for normal ELF binaries.
>> That's another reason. If somebody does a symlink to our wrapper, then
>> $0 will contain the full path to the link, not to the wrapper
>> itself.
> So we need to readlink it first.
Yes, or read /proc/self/exec.
>> If somebody does a hardlink, /proc/self/exe won't even fix it for you -
>> But that is probably quite unlikely.
> For the hardlink case there is no solution.
Indeed.
--
Venlig hilsen,
Peter Korsgaard
More information about the buildroot
mailing list