]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
test/fio/fio_ceph_messenger: fix str_to_ptr() crash at windows 45690/head
authorTao <34903089+sleepinging@users.noreply.github.com>
Tue, 29 Mar 2022 14:13:30 +0000 (22:13 +0800)
committerIlya Dryomov <idryomov@gmail.com>
Wed, 6 Apr 2022 10:56:03 +0000 (12:56 +0200)
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 <i237731947@outlook.com>
src/test/fio/fio_ceph_messenger.cc

index cab2d3db698d03aef55b0f78435d2499c87e0098..8c962af5df72b92ccb9dd547767206238ae5d4b8 100644 (file)
@@ -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<void*>(ceph::parse<uintptr_t>(str, 16).value());
 }
 
 static std::string ptr_to_str(void *ptr)