Skip to content

Commit d08aa4b

Browse files
committed
oci: fix the file mode of the device
Signed-off-by: Iceber Gu <wei.cai-nat@daocloud.io>
1 parent ddcc431 commit d08aa4b

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

oci/spec_opts_linux.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ func deviceFromPath(path, permissions string) (*specs.LinuxDevice, error) {
108108
case mode&unix.S_IFCHR == unix.S_IFCHR:
109109
devType = "c"
110110
}
111-
fm := os.FileMode(mode)
111+
fm := os.FileMode(mode &^ unix.S_IFMT)
112112
return &specs.LinuxDevice{
113113
Type: devType,
114114
Path: path,

oci/spec_opts_unix.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ func deviceFromPath(path, permissions string) (*specs.LinuxDevice, error) {
107107
case mode&unix.S_IFCHR == unix.S_IFCHR:
108108
devType = "c"
109109
}
110-
fm := os.FileMode(mode)
110+
fm := os.FileMode(mode &^ unix.S_IFMT)
111111
return &specs.LinuxDevice{
112112
Type: devType,
113113
Path: path,

0 commit comments

Comments
 (0)