Repository navigation
Filesystem/Win32: Recreate hardlinks on fs::pending_file - #16256
Merged
Merged
Conversation
elad335
force-pushed
the
lv2
branch
3 times, most recently
from
October 27, 2024 13:09
8f58b56 to
a3ff474
Compare
elad335
marked this pull request as draft
October 27, 2024 13:22
Megamouse
reviewed
Oct 27, 2024
| ensure(SetFileInformationByHandle(file.get_handle(), FileDispositionInfo, &disp, sizeof(disp))); | ||
| } | ||
|
|
||
| std::vector<std::wstring> hardlinkPaths; |
Megamouse
reviewed
Oct 27, 2024
|
|
||
| const auto ws1 = to_wchar(m_path); | ||
|
|
||
| const HANDLE fileHandle = CreateFileW(ws1.get(), GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, nullptr, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, nullptr); |
Megamouse
reviewed
Oct 27, 2024
| while (fileHandle != INVALID_HANDLE_VALUE) | ||
| { | ||
| // Get file ID (used to check for hardlinks) | ||
| BY_HANDLE_FILE_INFORMATION fileInfo; |
RipleyTom
reviewed
Oct 28, 2024
|
|
||
| // Buffer for holding link name | ||
| WCHAR linkNameBuffer[MAX_PATH]; | ||
| HANDLE findHandle = FindFirstFileNameW(ws1.get(), 0, nullptr, linkNameBuffer); |
Contributor
There was a problem hiding this comment.
Two things:
-Limiting to MAX_PATH on windows has been a problem in the past if I recall, we should avoid that if possible
-Is nullptr for StringLength even valid, documentation doesn't mention it
elad335
force-pushed
the
lv2
branch
3 times, most recently
from
October 28, 2024 05:15
307c02c to
a896624
Compare
elad335
marked this pull request as ready for review
October 28, 2024 10:19
Contributor
|
maybe the fix for #16245 (reported in that PR) could be also provided in this PR |
Megamouse
reviewed
Oct 28, 2024
| while (true) | ||
| { | ||
| buffer_size = link_name_buffer.size() - 1; | ||
| findHandle = FindFirstFileNameW(ws1.get(), 0, &buffer_size, link_name_buffer.data()); |
Contributor
There was a problem hiding this comment.
Suggested change
| findHandle = FindFirstFileNameW(ws1.get(), 0, &buffer_size, link_name_buffer.data()); | |
| find_handle = FindFirstFileNameW(ws1.get(), 0, &buffer_size, link_name_buffer.data()); |
elad335
force-pushed
the
lv2
branch
11 times, most recently
from
October 29, 2024 15:06
411b52d to
db4a7ca
Compare
elad335
force-pushed
the
lv2
branch
2 times, most recently
from
October 29, 2024 15:16
fd8df8d to
cca8138
Compare
elad335
force-pushed
the
lv2
branch
2 times, most recently
from
October 29, 2024 16:12
4808c47 to
0b7a9f8
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Attempting to address #16255
Also fixes #16260