diff -r b3a89736b23e -r 66c22e54aa90 src/server/daemon/vfs.c --- a/src/server/daemon/vfs.c Sun Mar 17 19:19:57 2013 +0100 +++ b/src/server/daemon/vfs.c Tue Mar 19 17:38:32 2013 +0100 @@ -96,7 +96,8 @@ } // open file - int fd = open(path, oflags); + mode_t mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH; + int fd = open(path, oflags, mode); if(fd == -1) { if(ctx) { ctx->vfs_errno = errno; @@ -410,14 +411,20 @@ int sys_dir_read(VFS_DIR dir, VFS_ENTRY *entry, int getstat) { struct dirent *e = readdir(dir->data); if(e) { - entry->name = e->d_name; - if(getstat) { - // TODO: check ACLs again for new path - if(fstatat(dir->fd, e->d_name, &entry->stat, 0)) { - entry->stat_errno = errno; + char *name = e->d_name; + if(!strcmp(name, ".") || !strcmp(name, "..")) { + return sys_dir_read(dir, entry, getstat); + } else { + entry->name = name; + if(getstat) { + // TODO: check ACLs again for new path + if(fstatat(dir->fd, e->d_name, &entry->stat, 0)) { + entry->stat_errno = errno; + } + entry->stat_extra = NULL; } + return 1; } - return 1; } else { return 0; } @@ -435,3 +442,18 @@ int sys_unlink(VFSContext *ctx, char *path) { return unlink(path); } + +/* public file api */ + +NSAPI_PUBLIC int system_fread(SYS_FILE fd, void *buf, int nbyte) { + return fd->io->read(fd, buf, nbyte); +} + +NSAPI_PUBLIC int system_fwrite(SYS_FILE fd, const void *buf, int nbyte) { + return fd->io->write(fd, buf, nbyte); +} + +NSAPI_PUBLIC int system_fclose(SYS_FILE fd) { + vfs_close(fd); + return 0; +}