290 acl_set_error_status(ctx->sn, ctx->rq, sysacl.acl, ctx->user); |
290 acl_set_error_status(ctx->sn, ctx->rq, sysacl.acl, ctx->user); |
291 return NULL; |
291 return NULL; |
292 } |
292 } |
293 } |
293 } |
294 |
294 |
295 // open file |
295 // open file |
296 int sys_fd = open(path, O_RDONLY); |
296 DIR *sys_dir = opendir(path); |
297 if(sys_fd == -1) { |
|
298 if(ctx) { |
|
299 ctx->vfs_errno = errno; |
|
300 sys_set_error_status(ctx); |
|
301 } |
|
302 return NULL; |
|
303 } |
|
304 |
|
305 DIR *sys_dir = fdopendir(sys_fd); |
|
306 if(!sys_dir) { |
297 if(!sys_dir) { |
307 if(ctx) { |
298 if(ctx) { |
308 ctx->vfs_errno = errno; |
299 ctx->vfs_errno = errno; |
309 sys_set_error_status(ctx); |
300 sys_set_error_status(ctx); |
310 } |
301 } |
464 char *name = e->d_name; |
455 char *name = e->d_name; |
465 if(!strcmp(name, ".") || !strcmp(name, "..")) { |
456 if(!strcmp(name, ".") || !strcmp(name, "..")) { |
466 return sys_dir_read(dir, entry, getstat); |
457 return sys_dir_read(dir, entry, getstat); |
467 } else { |
458 } else { |
468 entry->name = name; |
459 entry->name = name; |
|
460 #ifndef OSX |
|
461 /* TODO: |
|
462 * implement alternative for fstat for OS X and other crappy |
|
463 * Unices |
|
464 */ |
469 if(getstat) { |
465 if(getstat) { |
470 // TODO: check ACLs again for new path |
466 // TODO: check ACLs again for new path |
471 if(fstatat(dir->fd, e->d_name, &entry->stat, 0)) { |
467 if(fstatat(dir->fd, e->d_name, &entry->stat, 0)) { |
472 entry->stat_errno = errno; |
468 entry->stat_errno = errno; |
473 } |
469 } |
474 entry->stat_extra = NULL; |
470 entry->stat_extra = NULL; |
475 } |
471 } |
|
472 #endif |
476 return 1; |
473 return 1; |
477 } |
474 } |
478 } else { |
475 } else { |
479 return 0; |
476 return 0; |
480 } |
477 } |