diff --git a/cmd/nvidia-cdi-hook/create-symlinks/create-symlinks.go b/cmd/nvidia-cdi-hook/create-symlinks/create-symlinks.go index 50f012ea..e9a6033f 100644 --- a/cmd/nvidia-cdi-hook/create-symlinks/create-symlinks.go +++ b/cmd/nvidia-cdi-hook/create-symlinks/create-symlinks.go @@ -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) }