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:
commit
7410b04649
1 changed files with 4 additions and 4 deletions
|
@ -189,15 +189,15 @@ func DirCopy(srcDir, dstDir string, copyMode Mode, copyXattrs bool) error {
|
||||||
case os.ModeNamedPipe:
|
case os.ModeNamedPipe:
|
||||||
fallthrough
|
fallthrough
|
||||||
case os.ModeSocket:
|
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 {
|
if err := unix.Mkfifo(dstPath, stat.Mode); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
case os.ModeDevice:
|
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 {
|
if err := unix.Mknod(dstPath, stat.Mode, int(stat.Rdev)); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue