mirror of
https://github.com/NVIDIA/nvidia-container-toolkit
synced 2024-11-22 00:08:11 +00:00
[no-relnote] Remove redundant changeRoot for link target
Since hostRoot is always the empty string and we are changing the root in the target path to /, the call to changeRoot is redundant. Signed-off-by: Evan Lezar <elezar@nvidia.com>
This commit is contained in:
parent
fa59d12973
commit
6a6a3e6055
@ -114,23 +114,18 @@ func (m command) run(c *cli.Context, cfg *config) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m command) createLink(hostRoot string, containerRoot string, target string, link string) error {
|
||||
func (m command) createLink(hostRoot string, containerRoot string, targetPath string, link string) error {
|
||||
linkPath, err := changeRoot(hostRoot, containerRoot, link)
|
||||
if err != nil {
|
||||
m.logger.Warningf("Failed to resolve path for link %v relative to %v: %v", link, containerRoot, err)
|
||||
}
|
||||
|
||||
targetPath, err := changeRoot(hostRoot, "/", target)
|
||||
if err != nil {
|
||||
m.logger.Warningf("Failed to resolve path for target %v relative to %v: %v", target, "/", err)
|
||||
}
|
||||
|
||||
m.logger.Infof("Symlinking %v to %v", linkPath, targetPath)
|
||||
err = os.MkdirAll(filepath.Dir(linkPath), 0755)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to create directory: %v", err)
|
||||
}
|
||||
err = os.Symlink(target, linkPath)
|
||||
err = os.Symlink(targetPath, linkPath)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to create symlink: %v", err)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user