Skip to content

Commit

Permalink
Lint S3File.cc
Browse files Browse the repository at this point in the history
  • Loading branch information
jhiemstrawisc committed Apr 22, 2024
1 parent 5079389 commit a013861
Showing 1 changed file with 12 additions and 13 deletions.
25 changes: 12 additions & 13 deletions src/S3File.cc
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ int S3File::Open(const char *path, int Oflag, mode_t Mode, XrdOucEnv &env) {
std::string configured_s3_secret_key =
m_oss->getS3SecretKeyFile(exposedPath);
std::string configured_s3_bucket_name = m_oss->getS3BucketName(exposedPath);
std::string configured_s3_url_style = m_oss->getS3URLStyle();
std::string configured_s3_url_style = m_oss->getS3URLStyle();

// We used to query S3 here to see if the object existed, but of course
// if you're creating a file on upload, you don't care.
Expand All @@ -117,20 +117,19 @@ int S3File::Open(const char *path, int Oflag, mode_t Mode, XrdOucEnv &env) {
this->s3_secret_key = configured_s3_secret_key;
this->s3_url_style = configured_s3_url_style;

//This flag is not set when it's going to be a read operation
//so we check if the file exists in order to be able to return a 404
if (!Oflag) {
AmazonS3Head head(this->s3_service_url, this->s3_access_key,
this->s3_secret_key, this->s3_bucket_name,
this->s3_object_name, this->s3_url_style, m_log);

if (!head.SendRequest()) {
return -ENOENT;
}
// This flag is not set when it's going to be a read operation
// so we check if the file exists in order to be able to return a 404
if (!Oflag) {
AmazonS3Head head(this->s3_service_url, this->s3_access_key,
this->s3_secret_key, this->s3_bucket_name,
this->s3_object_name, this->s3_url_style, m_log);

}
if (!head.SendRequest()) {
return -ENOENT;
}
}

return 0;
return 0;
}

ssize_t S3File::Read(void *buffer, off_t offset, size_t size) {
Expand Down

0 comments on commit a013861

Please sign in to comment.