plan9port

fork of plan9port with libvec, libstr and libsdb
Log | Files | Refs | README | LICENSE

commit e465991ea6c7d2b9f52cabf398b9b087a0b25427
parent 0ac670585c5eac5a6348aeb0e7b018659b2dbc09
Author: Russ Cox <rsc@swtch.com>
Date:   Tue, 30 Dec 2008 14:27:30 -0800

9pfuse: allow O_APPEND in open and create (Roman Shaposhnik)

Diffstat:
Msrc/cmd/9pfuse/main.c | 9++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/cmd/9pfuse/main.c b/src/cmd/9pfuse/main.c @@ -577,6 +577,13 @@ _fuseopen(FuseMsg *m, int isdir) openmode = flags&3; flags &= ~3; flags &= ~(O_DIRECTORY|O_NONBLOCK|O_LARGEFILE|O_CLOEXEC); + /* + * Discarding O_APPEND here is not completely wrong, + * because the host kernel will rewrite the offsets + * of write system calls for us. That's the best we + * can do on Unix anyway. + */ + flags &= ~O_APPEND; if(flags & O_TRUNC){ openmode |= OTRUNC; flags &= ~O_TRUNC; @@ -585,7 +592,6 @@ _fuseopen(FuseMsg *m, int isdir) * Could translate but not standard 9P: * O_DIRECT -> ODIRECT * O_NONBLOCK -> ONONBLOCK - * O_APPEND -> OAPPEND */ if(flags){ fprint(2, "unexpected open flags %#uo", (uint)in->flags); @@ -702,6 +708,7 @@ fusecreate(FuseMsg *m) openmode = in->flags&3; flags &= ~3; flags &= ~(O_DIRECTORY|O_NONBLOCK|O_LARGEFILE); + flags &= ~O_APPEND; /* see comment in _fuseopen */ flags &= ~(O_CREAT|O_TRUNC); /* huh? */ if(flags){ fprint(2, "bad mode %#uo\n", in->flags);