vx32

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

commit d6805ad211fef6ae03a3bd1c0685337ce31c7135
parent 5a8965c8d5146ba16035636c7e587110a3c09356
Author: Ron Minnich <rminnich@gmail.com>
Date:   Mon,  5 Oct 2009 02:53:41 -0400

9vx: handle create of new directory with zero permissions

http://codereview.appspot.com/124107

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

diff --git a/src/9vx/devfs-posix.c b/src/9vx/devfs-posix.c @@ -452,13 +452,11 @@ fscreate(Chan *c, char *name, int mode, ulong perm) if(perm & DMDIR){ if(mode != OREAD) error(Eperm); - if(mkdir(path, perm & 0777) < 0) + /* have to do the minimum 0400 so we can open it */ + if(mkdir(path, 0400 | perm & 0777) < 0) oserror(); if((fd = open(path, 0)) < 0) oserror(); - // Be like Plan 9 file servers: inherit mode bits - // and group from parent. - fchmod(fd, perm & st.st_mode & 0777); fchown(fd, -1, st.st_gid); if(fstat(fd, &st) < 0){ close(fd); @@ -467,6 +465,9 @@ fscreate(Chan *c, char *name, int mode, ulong perm) close(fd); if((ufd->dir = opendir(path)) == nil) oserror(); + // Be like Plan 9 file servers: inherit mode bits + // and group from parent. + fchmod(ufd->dir, perm & st.st_mode & 0777); ufd->diroffset = 0; ufd->nextde = nil; }else{