1
1
mirror of https://github.com/rui314/mold.git synced 2024-10-04 00:31:41 +03:00

Attempt to fix CI

This commit is contained in:
Rui Ueyama 2024-06-22 13:51:30 +09:00
parent 4cc61361f3
commit 07b09a66d3
2 changed files with 6 additions and 8 deletions

View File

@ -44,9 +44,8 @@ void MappedFile::close_fd() {
}
void MappedFile::reopen_fd(const std::string &path) {
if (fd != -1)
close(fd);
fd = open(path.c_str(), O_RDONLY);
if (fd == -1)
fd = open(path.c_str(), O_RDONLY);
}
} // namespace mold

View File

@ -72,11 +72,10 @@ void MappedFile::close_fd() {
}
void MappedFile::reopen_fd(const std::string &path) {
if (fd != INVALID_HANDLE_VALUE)
CloseHandle(fd);
fd = CreateFileA(path.c_str(), GENERIC_READ,
FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr);
if (fd == INVALID_HANDLE_VALUE)
fd = CreateFileA(path.c_str(), GENERIC_READ,
FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr);
}
} // namespace mold