vx32

Local 9vx git repository for patches.
git clone git://r-36.net/vx32
Log | Files | Refs

commit 00abd820d8e8bd22aa1b4ab035415450f4e5c965
parent d6805ad211fef6ae03a3bd1c0685337ce31c7135
Author: Ron Minnich <rminnich@gmail.com>
Date:   Sun, 25 Oct 2009 17:52:35 -0700

9vx: clean up DMDIR 0

R=rsc,vx32.codebot
APPROVED=rsc
http://codereview.appspot.com/124117

Diffstat:
src/9vx/devfs-posix.c | 14++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/src/9vx/devfs-posix.c b/src/9vx/devfs-posix.c @@ -453,7 +453,7 @@ fscreate(Chan *c, char *name, int mode, ulong perm) if(mode != OREAD) error(Eperm); /* have to do the minimum 0400 so we can open it */ - if(mkdir(path, 0400 | perm & 0777) < 0) + if(mkdir(path, (0400 | perm) & 0777) < 0) oserror(); if((fd = open(path, 0)) < 0) oserror(); @@ -462,12 +462,18 @@ fscreate(Chan *c, char *name, int mode, ulong perm) close(fd); oserror(); } - close(fd); - if((ufd->dir = opendir(path)) == nil) + if((ufd->dir = opendir(path)) == nil) { + /* arguably we should set the mode here too + * but it's hard to see that this case + * will ever happen + */ + close(fd); oserror(); + } // Be like Plan 9 file servers: inherit mode bits // and group from parent. - fchmod(ufd->dir, perm & st.st_mode & 0777); + fchmod(fd, perm & st.st_mode & 0777); + close(fd); ufd->diroffset = 0; ufd->nextde = nil; }else{