mirror of
https://github.com/containers/podman.git
synced 2025-09-18 15:54:49 +08:00
rootless cni: resolve absolute symlinks correctly
When /etc/resolv.conf is a symlink to an absolute path use it and not join it the the previous path. [NO TESTS NEEDED] This depends on the host layout. Fixes #11358 Signed-off-by: Paul Holzinger <pholzing@redhat.com>
This commit is contained in:
@ -185,7 +185,13 @@ func (r *RootlessCNI) Do(toRun func() error) error {
|
|||||||
// if there is no symlink exit
|
// if there is no symlink exit
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
resolvePath = filepath.Join(filepath.Dir(resolvePath), link)
|
if filepath.IsAbs(link) {
|
||||||
|
// link is as an absolute path
|
||||||
|
resolvePath = link
|
||||||
|
} else {
|
||||||
|
// link is as a relative, join it with the previous path
|
||||||
|
resolvePath = filepath.Join(filepath.Dir(resolvePath), link)
|
||||||
|
}
|
||||||
if strings.HasPrefix(resolvePath, "/run/") {
|
if strings.HasPrefix(resolvePath, "/run/") {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user