Skip to content

Commit

Permalink
Merge pull request #855 from giuseppe/copy-create-socket-not-a-fifo
Browse files Browse the repository at this point in the history
copy: create a unix socket with os.ModeSocket
  • Loading branch information
vrothberg committed Mar 15, 2021
2 parents eb714be + 029896b commit 1b9e7e3
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions drivers/copy/copy_linux.go
Expand Up @@ -15,6 +15,7 @@ import (
"errors"
"fmt"
"io"
"net"
"os"
"path/filepath"
"strings"
Expand Down Expand Up @@ -192,12 +193,16 @@ func DirCopy(srcDir, dstDir string, copyMode Mode, copyXattrs bool) error {
}

case mode&os.ModeNamedPipe != 0:
fallthrough
if err := unix.Mkfifo(dstPath, stat.Mode); err != nil {
return err
}

case mode&os.ModeSocket != 0:
if err := unix.Mkfifo(dstPath, stat.Mode); err != nil {
s, err := net.Listen("unix", dstPath)
if err != nil {
return err
}
s.Close()

case mode&os.ModeDevice != 0:
if rsystem.RunningInUserNS() {
Expand Down

0 comments on commit 1b9e7e3

Please sign in to comment.