From 2a4f3f206bf3e86f139b4cd2b7a379da25647e38 Mon Sep 17 00:00:00 2001 From: studyztp Date: Wed, 23 Aug 2023 16:27:45 -0700 Subject: [PATCH] sim: modifed the type of path Change-Id: I56be3b62b1804371b9b9e0f84ee1ec49cbedf553 --- src/sim/fd_array.cc | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/sim/fd_array.cc b/src/sim/fd_array.cc index d8cb981a93..f3605a5b7d 100644 --- a/src/sim/fd_array.cc +++ b/src/sim/fd_array.cc @@ -420,23 +420,23 @@ FDArray::unserialize(CheckpointIn &cp, SimObject* process_ptr) { mode_t mode = this_ffd->getFileMode(); - std::string const& path = this_ffd->getFileName(); + std::string path; + + if (process_ptr) + { + Process* ptr = static_cast(process_ptr); + path = ptr->checkPathRedirect(this_ffd->getFileName()); + } + else + { + path = this_ffd->getFileName(); + } int flags = this_ffd->getFlags(); // Re-open the file and assign a new sim_fd int sim_fd; - if (process_ptr) - { - Process* ptr = static_cast(process_ptr); - std::string const& host_path = - ptr->checkPathRedirect(this_ffd->getFileName()); - sim_fd = openFile(host_path, flags, mode); - } - else - { - sim_fd = openFile(path, flags, mode); - } + sim_fd = openFile(path, flags, mode); this_ffd->setSimFD(sim_fd);