summaryrefslogtreecommitdiffhomepage
path: root/runsc/specutils
diff options
context:
space:
mode:
authorLantao Liu <lantaol@google.com>2018-06-18 13:36:55 -0700
committerShentubot <shentubot@google.com>2018-06-18 13:37:59 -0700
commitf3727528e57ab720fac55553471b31877163cc12 (patch)
tree4d18133d4aff4bf27440a1279c73ca3ca51998c9 /runsc/specutils
parent821aaf531d62dc4f66078528901e536524951e3b (diff)
runsc: support symlink to the exec path.
PiperOrigin-RevId: 201049912 Change-Id: Idd937492217a4c2ca3d59c602e41576a3b203dd9
Diffstat (limited to 'runsc/specutils')
-rw-r--r--runsc/specutils/specutils.go4
1 files changed, 3 insertions, 1 deletions
diff --git a/runsc/specutils/specutils.go b/runsc/specutils/specutils.go
index 0bb462eb5..8dae3efb1 100644
--- a/runsc/specutils/specutils.go
+++ b/runsc/specutils/specutils.go
@@ -106,7 +106,9 @@ func GetExecutablePath(exec, root string, env []string) (string, error) {
// for.
for _, p := range path {
abs := filepath.Join(root, p, exec)
- if _, err := os.Stat(abs); err == nil {
+ // Do not follow symlink link because the target is in the container
+ // root filesystem.
+ if _, err := os.Lstat(abs); err == nil {
// We found it! Return the path relative to the root.
return filepath.Join("/", p, exec), nil
}