Skip to content

Commit 88f2e1c

Browse files
committed
Solve issues in windows library path listing.
1 parent 851d08d commit 88f2e1c

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

source/portability/source/portability_library_path.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,8 @@ int portability_library_path_find(const char name[], portability_library_path_st
158158
{
159159
size_t iterator, size = modules_size / sizeof(HMODULE);
160160

161-
for (iterator = 0; iterator < size; ++iterator)
161+
/* Start from 1 so we avoid the executable itself */
162+
for (iterator = 1; iterator < size; ++iterator)
162163
{
163164
if (GetModuleFileNameEx(handle_process, handle_modules[iterator], path, PORTABILITY_PATH_SIZE))
164165
{
@@ -267,7 +268,8 @@ int portability_library_path_list(portability_library_path_list_cb callback, voi
267268
size_t iterator, size = modules_size / sizeof(HMODULE);
268269
char module_name[MAX_PATH];
269270

270-
for (iterator = 0; iterator < size; ++iterator)
271+
/* Start from 1 so we avoid the executable itself */
272+
for (iterator = 1; iterator < size; ++iterator)
271273
{
272274
if (GetModuleFileNameExA(process, modules[iterator], module_name, sizeof(module_name) / sizeof(char)))
273275
{

0 commit comments

Comments
 (0)