src/server/daemon/vfs.c

changeset 69
4a10bc0ee80d
parent 67
50505dc3f8a6
child 70
4e6e812c1d97
--- a/src/server/daemon/vfs.c	Mon May 27 12:28:56 2013 +0200
+++ b/src/server/daemon/vfs.c	Thu Jun 20 13:27:07 2013 +0200
@@ -292,17 +292,8 @@
         }
     }
     
-    // open file
-    int sys_fd = open(path, O_RDONLY);
-    if(sys_fd == -1) {
-        if(ctx) {
-            ctx->vfs_errno = errno;
-            sys_set_error_status(ctx);
-        }
-        return NULL;
-    }
-    
-    DIR *sys_dir = fdopendir(sys_fd);
+    // open file  
+    DIR *sys_dir = opendir(path);
     if(!sys_dir) {
         if(ctx) {
             ctx->vfs_errno = errno;
@@ -319,7 +310,7 @@
     }
     dir->ctx = ctx;
     dir->data = sys_dir;
-    dir->fd = sys_fd;
+    dir->fd = dirfd(dir);
     dir->io = &sys_dir_io;
     return dir;
 }
@@ -466,6 +457,11 @@
             return sys_dir_read(dir, entry, getstat);
         } else {
             entry->name = name;
+#ifndef OSX
+            /* TODO:
+             * implement alternative for fstat for OS X and other crappy
+             * Unices
+             */
             if(getstat) {
                 // TODO: check ACLs again for new path
                 if(fstatat(dir->fd, e->d_name, &entry->stat, 0)) {
@@ -473,6 +469,7 @@
                 }
                 entry->stat_extra = NULL;
             }
+#endif      
             return 1;
         }
     } else {

mercurial