Skip to content

Commit e9e7c22

Browse files
committed
fuse: don't set flagname keyed by syscall.O_LARGEFILE
On amd64, syscall.O_LARGEFILE is 0x0, making it be ignored as a key. However, the kernel always passes 0x8000 to the FUSE server for the OPEN call. The previous behavior causes crashes on 386, because the flagname is added twice. Change-Id: Ibabcdfef4d90e4fa4d02963d45a4d4cf2cba1ea2
1 parent cbb13ba commit e9e7c22

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

fuse/print.go

+12-10
Original file line numberDiff line numberDiff line change
@@ -54,16 +54,18 @@ var (
5454
RELEASE_FLUSH: "FLUSH",
5555
})
5656
openFlagNames = newFlagNames(map[int64]string{
57-
int64(os.O_WRONLY): "WRONLY",
58-
int64(os.O_RDWR): "RDWR",
59-
int64(os.O_APPEND): "APPEND",
60-
int64(syscall.O_ASYNC): "ASYNC",
61-
int64(os.O_CREATE): "CREAT",
62-
int64(os.O_EXCL): "EXCL",
63-
int64(syscall.O_NOCTTY): "NOCTTY",
64-
int64(syscall.O_NONBLOCK): "NONBLOCK",
65-
int64(os.O_SYNC): "SYNC",
66-
int64(os.O_TRUNC): "TRUNC",
57+
int64(os.O_WRONLY): "WRONLY",
58+
int64(os.O_RDWR): "RDWR",
59+
int64(os.O_APPEND): "APPEND",
60+
int64(syscall.O_ASYNC): "ASYNC",
61+
int64(os.O_CREATE): "CREAT",
62+
int64(os.O_EXCL): "EXCL",
63+
int64(syscall.O_NOCTTY): "NOCTTY",
64+
int64(syscall.O_NONBLOCK): "NONBLOCK",
65+
int64(os.O_SYNC): "SYNC",
66+
int64(os.O_TRUNC): "TRUNC",
67+
// syscall.O_LARGEFILE is 0x0 on x86_64, but the
68+
// kernel supplies 0x8000 anyway.
6769
0x8000: "LARGEFILE",
6870
int64(syscall.O_CLOEXEC): "CLOEXEC",
6971
int64(syscall.O_DIRECTORY): "DIRECTORY",

fuse/print_linux.go

-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import (
1111

1212
func init() {
1313
openFlagNames.set(syscall.O_DIRECT, "DIRECT")
14-
openFlagNames.set(syscall.O_LARGEFILE, "LARGEFILE")
1514
openFlagNames.set(syscall_O_NOATIME, "NOATIME")
1615
initFlagNames.set(CAP_NO_OPENDIR_SUPPORT, "NO_OPENDIR_SUPPORT")
1716
initFlagNames.set(CAP_EXPLICIT_INVAL_DATA, "EXPLICIT_INVAL_DATA")

0 commit comments

Comments
 (0)