diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2023-05-29 16:57:04 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-29 16:57:04 (GMT) |
commit | 68bf3fe0e4221bd33823b727af1f70708bdb8f29 (patch) | |
tree | 66b9ac4ded084f30b702d332bcbd4d07b0661122 /Python/fileutils.c | |
parent | 635ce29257a7f7272af009d3c08379522317d89b (diff) | |
download | cpython-68bf3fe0e4221bd33823b727af1f70708bdb8f29.zip cpython-68bf3fe0e4221bd33823b727af1f70708bdb8f29.tar.gz cpython-68bf3fe0e4221bd33823b727af1f70708bdb8f29.tar.bz2 |
gh-104820: Fixes os.stat on Windows to better handle file systems that do not support FileIdInformation (GH-104892)
(cherry picked from commit 6031727a37c6003f78e3b0c7414a0a214855dd08)
Co-authored-by: Steve Dower <steve.dower@python.org>
Diffstat (limited to 'Python/fileutils.c')
-rw-r--r-- | Python/fileutils.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/Python/fileutils.c b/Python/fileutils.c index 969b716..f137ee9 100644 --- a/Python/fileutils.c +++ b/Python/fileutils.c @@ -1132,7 +1132,8 @@ _Py_attribute_data_to_stat(BY_HANDLE_FILE_INFORMATION *info, ULONG reparse_tag, file_id.id = id_info->FileId; result->st_ino = file_id.st_ino; result->st_ino_high = file_id.st_ino_high; - } else { + } + if (!result->st_ino && !result->st_ino_high) { /* should only occur for DirEntry_from_find_data, in which case the index is likely to be zero anyway. */ result->st_ino = (((uint64_t)info->nFileIndexHigh) << 32) + info->nFileIndexLow; |