Skip to content

Commit

Permalink
work around apparent macfuse bug (open flags not being passed into re…
Browse files Browse the repository at this point in the history
…lease?)
  • Loading branch information
mikejs committed Sep 28, 2009
1 parent b451282 commit a2f79ed
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion operations.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ using namespace mongo;

std::map<string, LocalGridFile*> open_files;

unsigned int FH;

int gridfs_getattr(const char *path, struct stat *stbuf)
{
int res = 0;
Expand Down Expand Up @@ -140,14 +142,19 @@ int gridfs_create(const char* path, mode_t mode, struct fuse_file_info* ffi)

open_files[path] = new LocalGridFile(DEFAULT_CHUNK_SIZE);

ffi->fh = FH++;

return 0;
}

int gridfs_release(const char* path, struct fuse_file_info* ffi)
{
path = fuse_to_mongo_path(path);

if((ffi->flags & O_ACCMODE) == O_RDONLY) {
if(!ffi->fh) {
// fh is not set if file is opened read only
// Would check ffi->flags for O_RDONLY instead but MacFuse doesn't
// seem to properly pass flags into release
return 0;
}

Expand Down

0 comments on commit a2f79ed

Please sign in to comment.