1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Merge pull request #36756 from redbaron/userns-copy-fifo-fix

Fix FIFO, sockets and device files when run in user NS
This commit is contained in:
Tõnis Tiigi 2018-04-01 20:02:11 -07:00 committed by GitHub
commit 7410b04649
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -189,15 +189,15 @@ func DirCopy(srcDir, dstDir string, copyMode Mode, copyXattrs bool) error {
case os.ModeNamedPipe:
fallthrough
case os.ModeSocket:
if rsystem.RunningInUserNS() {
// cannot create a device if running in user namespace
return nil
}
if err := unix.Mkfifo(dstPath, stat.Mode); err != nil {
return err
}
case os.ModeDevice:
if rsystem.RunningInUserNS() {
// cannot create a device if running in user namespace
return nil
}
if err := unix.Mknod(dstPath, stat.Mode, int(stat.Rdev)); err != nil {
return err
}