Do not allow open with O_RDONLY and O_TRUNC (#1620)

Found via pjdfstests.  References #1589.
This commit is contained in:
Andrew Gaul 2021-04-13 07:28:10 +09:00 committed by GitHub
parent 23e1fbf7b9
commit 01a26a9011
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2204,6 +2204,10 @@ static int s3fs_open(const char* _path, struct fuse_file_info* fi)
S3FS_PRN_INFO("[path=%s][flags=0x%x]", path, fi->flags);
if ((fi->flags & O_ACCMODE) == O_RDONLY && fi->flags & O_TRUNC) {
return -EACCES;
}
// clear stat for reading fresh stat.
// (if object stat is changed, we refresh it. then s3fs gets always
// stat when s3fs open the object).