Fix broken uploadProgressCallback closure

Since the callback is global we can't refer to 'path' in it. This
could cause a segfault or printing of arbitrary data.
This commit is contained in:
Eelco Dolstra 2018-10-30 11:45:31 +01:00
parent 056c3fbbfc
commit 0163e8928c
No known key found for this signature in database
GPG key ID: 8170B4726D7198DE

View file

@ -269,14 +269,14 @@ struct S3BinaryCacheStoreImpl : public S3BinaryCacheStore
transferConfig.bufferSize = bufferSize; transferConfig.bufferSize = bufferSize;
transferConfig.uploadProgressCallback = transferConfig.uploadProgressCallback =
[&](const TransferManager *transferManager, [](const TransferManager *transferManager,
const std::shared_ptr<const TransferHandle> const std::shared_ptr<const TransferHandle>
&transferHandle) &transferHandle)
{ {
//FIXME: find a way to properly abort the multipart upload. //FIXME: find a way to properly abort the multipart upload.
//checkInterrupt(); //checkInterrupt();
debug("upload progress ('%s'): '%d' of '%d' bytes", debug("upload progress ('%s'): '%d' of '%d' bytes",
path, transferHandle->GetKey(),
transferHandle->GetBytesTransferred(), transferHandle->GetBytesTransferred(),
transferHandle->GetBytesTotalSize()); transferHandle->GetBytesTotalSize());
}; };