mirror of
https://github.com/NVIDIA/nvidia-container-toolkit
synced 2024-11-22 08:18:32 +00:00
Fix relative link resolution for ldcache
Signed-off-by: Evan Lezar <elezar@nvidia.com>
This commit is contained in:
parent
d091d3c7f4
commit
14bcebd8b7
@ -302,11 +302,14 @@ func (c *ldcache) resolve(target string) (string, error) {
|
|||||||
return "", fmt.Errorf("failed to resolve symlink: %v", err)
|
return "", fmt.Errorf("failed to resolve symlink: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if filepath.IsAbs(link) {
|
// We return absolute paths for all targets
|
||||||
c.logger.Debugf("Found absolute link %v", link)
|
if !filepath.IsAbs(link) || strings.HasPrefix(link, ".") {
|
||||||
link = filepath.Join(c.root, link)
|
link = filepath.Join(filepath.Dir(target), link)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Ensure that the returned path is relative to the root.
|
||||||
|
link = filepath.Join(c.root, link)
|
||||||
|
|
||||||
c.logger.Debugf("Resolved link: '%v' => '%v'", name, link)
|
c.logger.Debugf("Resolved link: '%v' => '%v'", name, link)
|
||||||
return link, nil
|
return link, nil
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user