Commit e9e7c22a authored by Han-Wen Nienhuys's avatar Han-Wen Nienhuys

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
parent cbb13ba8
...@@ -54,16 +54,18 @@ var ( ...@@ -54,16 +54,18 @@ var (
RELEASE_FLUSH: "FLUSH", RELEASE_FLUSH: "FLUSH",
}) })
openFlagNames = newFlagNames(map[int64]string{ openFlagNames = newFlagNames(map[int64]string{
int64(os.O_WRONLY): "WRONLY", int64(os.O_WRONLY): "WRONLY",
int64(os.O_RDWR): "RDWR", int64(os.O_RDWR): "RDWR",
int64(os.O_APPEND): "APPEND", int64(os.O_APPEND): "APPEND",
int64(syscall.O_ASYNC): "ASYNC", int64(syscall.O_ASYNC): "ASYNC",
int64(os.O_CREATE): "CREAT", int64(os.O_CREATE): "CREAT",
int64(os.O_EXCL): "EXCL", int64(os.O_EXCL): "EXCL",
int64(syscall.O_NOCTTY): "NOCTTY", int64(syscall.O_NOCTTY): "NOCTTY",
int64(syscall.O_NONBLOCK): "NONBLOCK", int64(syscall.O_NONBLOCK): "NONBLOCK",
int64(os.O_SYNC): "SYNC", int64(os.O_SYNC): "SYNC",
int64(os.O_TRUNC): "TRUNC", int64(os.O_TRUNC): "TRUNC",
// syscall.O_LARGEFILE is 0x0 on x86_64, but the
// kernel supplies 0x8000 anyway.
0x8000: "LARGEFILE", 0x8000: "LARGEFILE",
int64(syscall.O_CLOEXEC): "CLOEXEC", int64(syscall.O_CLOEXEC): "CLOEXEC",
int64(syscall.O_DIRECTORY): "DIRECTORY", int64(syscall.O_DIRECTORY): "DIRECTORY",
......
...@@ -11,7 +11,6 @@ import ( ...@@ -11,7 +11,6 @@ import (
func init() { func init() {
openFlagNames.set(syscall.O_DIRECT, "DIRECT") openFlagNames.set(syscall.O_DIRECT, "DIRECT")
openFlagNames.set(syscall.O_LARGEFILE, "LARGEFILE")
openFlagNames.set(syscall_O_NOATIME, "NOATIME") openFlagNames.set(syscall_O_NOATIME, "NOATIME")
initFlagNames.set(CAP_NO_OPENDIR_SUPPORT, "NO_OPENDIR_SUPPORT") initFlagNames.set(CAP_NO_OPENDIR_SUPPORT, "NO_OPENDIR_SUPPORT")
initFlagNames.set(CAP_EXPLICIT_INVAL_DATA, "EXPLICIT_INVAL_DATA") initFlagNames.set(CAP_EXPLICIT_INVAL_DATA, "EXPLICIT_INVAL_DATA")
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment