Merge pull request #466 from ggtakec/master

Fixed a bug about could not copy file mode from org file
This commit is contained in:
Takeshi Nakatani 2016-09-11 23:11:22 +09:00 committed by GitHub
commit a56fe0ea28
2 changed files with 18 additions and 2 deletions

View File

@ -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);

View File

@ -207,8 +207,13 @@ function test_chown {
# if they're the same, we have a problem.
if [ $(stat --format=%u:%g $TEST_TEXT_FILE) == $ORIGINAL_PERMISSIONS ]
then
echo "Could not modify $TEST_TEXT_FILE ownership"
return 1
if [ $ORIGINAL_PERMISSIONS == "1000:1000" ]
then
echo "Could not be strict check because original file permission 1000:1000"
else
echo "Could not modify $TEST_TEXT_FILE ownership($ORIGINAL_PERMISSIONS to 1000:1000)"
return 1
fi
fi
# clean up