Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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

…lease?)
  • Loading branch information...
commit a2f79ed73ca9c5e10d46660dad472a3d1976c617 1 parent b451282
@mikejs authored
Showing with 8 additions and 1 deletion.
  1. +8 −1 operations.cpp
View
9 operations.cpp
@@ -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,6 +142,8 @@ 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;
}
@@ -147,7 +151,10 @@ 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;
}
Please sign in to comment.
Something went wrong with that request. Please try again.