From 1290d5ca92015376bcb361b73130849e3c6271ac Mon Sep 17 00:00:00 2001 From: Lucian Petrut Date: Wed, 20 Jan 2021 11:42:03 +0000 Subject: [PATCH] rbd: use ceph_memzero_s instead of explicit_bzero explicit_bzero isn't available on Windows. We'll use the portable ceph_memzero_s function instead. Signed-off-by: Lucian Petrut (cherry picked from commit 4b94acad0c41d20cdae48e01fbbc1ae26229c75b) --- src/tools/rbd/action/Encryption.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/tools/rbd/action/Encryption.cc b/src/tools/rbd/action/Encryption.cc index 7796eee267d3c..a997fe7017eea 100644 --- a/src/tools/rbd/action/Encryption.cc +++ b/src/tools/rbd/action/Encryption.cc @@ -1,6 +1,7 @@ // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- // vim: ts=8 sw=2 smarttab +#include "include/compat.h" #include "include/scope_guard.h" #include "tools/rbd/ArgumentTypes.h" #include "tools/rbd/Shell.h" @@ -66,7 +67,7 @@ int execute(const po::variables_map &vm, std::string passphrase((std::istreambuf_iterator(file)), (std::istreambuf_iterator())); auto sg = make_scope_guard([&] { - explicit_bzero(&passphrase[0], passphrase.size()); }); + ceph_memzero_s(&passphrase[0], passphrase.size(), passphrase.size()); }); file.close(); if (!passphrase.empty() && passphrase[passphrase.length() - 1] == '\n') { passphrase.erase(passphrase.length() - 1); -- 2.39.5