Re: [PATCH bw/realpath-wo-chdir] real_path: canonicalize directory separators in root parts
- From
Johannes Sixt <j6t@kdbg.org>
- Date
- Dec 22, 2016, 18:54 UTC
- Message-ID
- <05333505-63ca-8733-e247-a57d4a9dac4d@kdbg.org>
- In-Reply-To
- <20161222173301.GB119874@google.com>
Am 22.12.2016 um 18:33 schrieb Brandon Williams:
> It took me a couple extra seconds to realize that > offset_1st_component returns 0 with a relative path, which makes causes > the call to get_root_part to essentially be a noop (ie nothing is > resolved).
Yeah, I am still unsure whether it is a good idea to optimize away the is_absolute_path() call, because we lose the symmetry to the symlink case, where we cannot get rid of the call...
But I think the condition plus comment
if (!resolved->len) {
/* relative path; can use CWD as the initial resolved path */makes things fairly clear.
-- Hannes