Skip to content
This repository has been archived by the owner on Jan 3, 2024. It is now read-only.

Commit

Permalink
rgw/sfs: Fix s3tests_boto3.functional.test_s3.test_post_object_* bug
Browse files Browse the repository at this point in the history
`mtime` parameter was logged but that's an output variable and might be
`nullptr`.

Avoid logging it and check if it's `nullptr` before setting the value.

Fixes: aquarist-labs/s3gw-tools#191
Signed-off-by: Xavi Garcia <xavi.garcia@suse.com>
  • Loading branch information
0xavi0 authored and Marcel Lauhoff committed Mar 17, 2023
1 parent 4c2c1da commit 4f0bfa9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
7 changes: 7 additions & 0 deletions src/rgw/driver/sfs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ The format is based on
and this project adheres to
[Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## Unreleased

### Fixed

- Fixed segfault when SFSAtomicWriter::complete is called whith mtime output
variable set to nullptr

## [0.7.0] - 2022-10-20

### Fixed
Expand Down
6 changes: 4 additions & 2 deletions src/rgw/driver/sfs/writer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ int SFSAtomicWriter::complete(
optional_yield y
) {
lsfs_dout(dpp, 10) << "accounted_size: " << accounted_size
<< ", etag: " << etag << ", mtime: " << to_iso_8601(*mtime)
<< ", etag: " << etag
<< ", set_mtime: " << to_iso_8601(set_mtime)
<< ", attrs: " << attrs
<< ", delete_at: " << to_iso_8601(delete_at)
Expand All @@ -116,7 +116,9 @@ int SFSAtomicWriter::complete(
meta.attrs = attrs;
bucketref->finish(dpp, obj.get_name());

*mtime = meta.mtime;
if (mtime != nullptr) {
*mtime = meta.mtime;
}
objref->metadata_finish(store);
return 0;
}
Expand Down

0 comments on commit 4f0bfa9

Please sign in to comment.