Browse Source

* fixed off-by-one error when initializing current_drive in the WASI system unit

Nikolay Nikolov 3 years ago
parent
commit
00d5bb5bbc
1 changed files with 1 additions and 1 deletions
  1. 1 1
      rtl/wasi/system.pp

+ 1 - 1
rtl/wasi/system.pp

@@ -238,7 +238,7 @@ begin
     end;
     Inc(fd);
   until res<>__WASI_ERRNO_SUCCESS;
-  while (current_drive<drives_count) and (current_dirs[current_drive].dir_name='') do
+  while (current_drive<(drives_count-1)) and (current_dirs[current_drive].dir_name='') do
     Inc(current_drive);
   for drive_nr:=0 to drives_count-1 do
   begin