Page MenuHomeFreeBSD

Resolve relative argv0 for direct exec mode to absolute path for AT_EXECPATH.
ClosedPublic

Authored by kib on Jan 2 2020, 11:25 PM.

Details

Summary

realpath(3) was already linked into ld-elf.so.1, so I reused it there to resolve dots and dotdots making the path more canonical.

[as promised]

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

kib retitled this revision from Resolve relative arv0 for direct exec mode to absolute path for AT_EXECPATH. to Resolve relative argv0 for direct exec mode to absolute path for AT_EXECPATH..Jan 3 2020, 1:19 AM
kib edited the summary of this revision. (Show Details)
This revision was not accepted when it landed; it landed in state Needs Review.Jan 9 2020, 10:00 AM
This revision was automatically updated to reflect the committed changes.
head/libexec/rtld-elf/rtld.c
5567

won't realpath already convert res to an absolute path? I think that this code will convert ./bar with pwd /tmp into /tmp/tmp/bar

head/libexec/rtld-elf/rtld.c
5567

Of course you are right. Please see D23121