From 1a96f40a1048bc4a259715d1c7ca75de25c383e2 Mon Sep 17 00:00:00 2001 From: Takeshi Nakatani Date: Sun, 11 Sep 2016 13:09:23 +0000 Subject: [PATCH] Fixed a bug about could not copy file mode from org file --- src/s3fs.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/s3fs.cpp b/src/s3fs.cpp index 194acee..93d285c 100644 --- a/src/s3fs.cpp +++ b/src/s3fs.cpp @@ -1561,6 +1561,17 @@ static int s3fs_chmod(const char* path, mode_t mode) return -EIO; } StatCache::getStatCacheData()->DelStat(nowcache); + + // check opened file handle. + // + // If we have already opened file handle, should set mode to it. + // And new mode is set when the file handle is closed. + // + FdEntity* ent; + if(NULL != (ent = FdManager::get()->ExistOpen(path))){ + ent->SetMode(mode); // Set new mode to opened fd. + FdManager::get()->Close(ent); + } } S3FS_MALLOCTRIM(0);