From f6fc581f59e31eba92147150dc903731fa49dcea Mon Sep 17 00:00:00 2001 From: Tao <34903089+sleepinging@users.noreply.github.com> Date: Tue, 29 Mar 2022 22:13:30 +0800 Subject: [PATCH] test/fio/fio_ceph_messenger: fix str_to_ptr() crash at windows I compiled a "fio_ceph_messenger. DLL" running on windows for FIO testing, but the original code is Linux, and the default size of long is 64 bits, but it is 32 bits on windows, resulting in a crash during pointer conversion. Now it has been running well in my computer Signed-off-by: wt.tao --- src/test/fio/fio_ceph_messenger.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/test/fio/fio_ceph_messenger.cc b/src/test/fio/fio_ceph_messenger.cc index cab2d3db698..8c962af5df7 100644 --- a/src/test/fio/fio_ceph_messenger.cc +++ b/src/test/fio/fio_ceph_messenger.cc @@ -80,7 +80,8 @@ struct ceph_msgr_reply_io { static void *str_to_ptr(const std::string &str) { - return (void *)strtoul(str.c_str(), NULL, 16); + // str is assumed to be a valid ptr string + return reinterpret_cast(ceph::parse(str, 16).value()); } static std::string ptr_to_str(void *ptr) -- 2.39.5