Skip to content

Commit 7a30dba

Browse files
committed
Only use FileId128 when it is non-zero
1 parent e55554d commit 7a30dba

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

Python/fileutils.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1166,8 +1166,13 @@ _Py_stat_basic_info_to_stat(FILE_STAT_BASIC_INFORMATION *info,
11661166
/* File systems with less than 128-bits zero pad into this field */
11671167
id_128_to_ino file_id;
11681168
file_id.id = info->FileId128;
1169-
result->st_ino = file_id.st_ino;
1170-
result->st_ino_high = file_id.st_ino_high;
1169+
if (file_id.st_ino && file_id.st_ino_high) {
1170+
result->st_ino = file_id.st_ino;
1171+
result->st_ino_high = file_id.st_ino_high;
1172+
} else {
1173+
result->st_ino = info->FileId.QuadPart;
1174+
result->st_ino_high = 0;
1175+
}
11711176
/* bpo-37834: Only actual symlinks set the S_IFLNK flag. But lstat() will
11721177
open other name surrogate reparse points without traversing them. To
11731178
detect/handle these, check st_file_attributes and st_reparse_tag. */

0 commit comments

Comments
 (0)