Merge pull request #290 from asridharan/dcos

Fixed the check for network namespace path.
This commit is contained in:
Dan Williams 2016-08-31 18:19:02 -05:00 committed by GitHub
commit e0ea82b229

View File

@ -20,7 +20,6 @@ import (
"os"
"path"
"runtime"
"strings"
"sync"
"syscall"
@ -101,19 +100,7 @@ func IsNSorErr(nspath string) error {
}
switch stat.Type {
case PROCFS_MAGIC:
// Kernel < 3.19
validPathContent := "ns/"
validName := strings.Contains(nspath, validPathContent)
if !validName {
return NSPathNotNSErr{msg: fmt.Sprintf("path %q doesn't contain %q", nspath, validPathContent)}
}
return nil
case NSFS_MAGIC:
// Kernel >= 3.19
case PROCFS_MAGIC, NSFS_MAGIC:
return nil
default:
return NSPathNotNSErr{msg: fmt.Sprintf("unknown FS magic on %q: %x", nspath, stat.Type)}