Permalink
Browse files

work around apparent macfuse bug (open flags not being passed into re…

…lease?)
  • Loading branch information...
1 parent b451282 commit a2f79ed73ca9c5e10d46660dad472a3d1976c617 @mikejs committed Sep 28, 2009
Showing with 8 additions and 1 deletion.
  1. +8 −1 operations.cpp
View
@@ -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;
@@ -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;
}

0 comments on commit a2f79ed

Please sign in to comment.