Skip to content

Commit 3b89ed9

Browse files
committed
FIX: query on directory was returning garbage size info.
fixes: metaeducation/rebol-issues#2304
1 parent 1c737e1 commit 3b89ed9

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/os/win32/dev-file.c

+8-3
Original file line numberDiff line numberDiff line change
@@ -376,9 +376,14 @@ static BOOL Seek_File_64(REBREQ *file)
376376
return DR_ERROR;
377377
}
378378

379-
if (info.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) SET_FLAG(file->modes, RFM_DIR);
380-
else CLR_FLAG(file->modes, RFM_DIR);
381-
file->file.size = ((i64)info.nFileSizeHigh << 32) + (i64)info.nFileSizeLow;
379+
if (info.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
380+
SET_FLAG(file->modes, RFM_DIR);
381+
file->file.size = 0;
382+
}
383+
else {
384+
CLR_FLAG(file->modes, RFM_DIR);
385+
file->file.size = ((i64)info.nFileSizeHigh << 32) + (i64)info.nFileSizeLow;
386+
}
382387
file->file.time.l = info.ftLastWriteTime.dwLowDateTime;
383388
file->file.time.h = info.ftLastWriteTime.dwHighDateTime;
384389
return DR_DONE;

0 commit comments

Comments
 (0)