Re: Can we avoid chdir'ing in resolve_symlinks() ?
| От | Tom Lane |
|---|---|
| Тема | Re: Can we avoid chdir'ing in resolve_symlinks() ? |
| Дата | |
| Msg-id | 1403451.1662218489@sss.pgh.pa.us обсуждение |
| Ответ на | Re: Can we avoid chdir'ing in resolve_symlinks() ? (Andrew Dunstan <andrew@dunslane.net>) |
| Ответы |
Re: Can we avoid chdir'ing in resolve_symlinks() ?
|
| Список | pgsql-hackers |
Andrew Dunstan <andrew@dunslane.net> writes:
> On 2022-09-01 Th 19:39, Tom Lane wrote:
>> find_my_exec() wants to obtain an absolute, symlink-free path
>> to the program's own executable, for what seem to me good
>> reasons. However, chasing down symlinks is left to its
>> subroutine resolve_symlinks(), which does this:
> These days there seem to be library functions that do this, realpath(3)
> and canonicalize_file_name(3). The latter is what seems to be called by
> readlink(1). Should we be using one of those?
Oh! I see realpath() in POSIX, but not canonicalize_file_name().
It does look like realpath() would be helpful here, although if
it's not present on Windows that's a problem.
Quick googling suggests that _fullpath() could be used as a substitute.
regards, tom lane
В списке pgsql-hackers по дате отправления: