Skip to content

Commit 0e37d08

Browse files
committed
Solve issue with macos.
1 parent c7a8ad3 commit 0e37d08

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

source/portability/source/portability_library_path.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,9 @@ int portability_library_path_find(const char name[], portability_library_path_st
189189

190190
if (portability_library_path_ends_with(name, "so") == 0 && name_dylib_length < PORTABILITY_PATH_SIZE)
191191
{
192-
memcpy(path, name, sizeof(char) * (name_length - 2));
193-
memcpy(path, dylib_suffix, sizeof(dylib_suffix));
192+
const size_t base_length = sizeof(char) * (name_length - 2);
193+
memcpy(path, name, base_length);
194+
memcpy(&path[base_length], dylib_suffix, sizeof(dylib_suffix));
194195
}
195196

196197
/* Start from 1 so we avoid the executable itself */
@@ -206,7 +207,7 @@ int portability_library_path_find(const char name[], portability_library_path_st
206207
printf("Debug ends with: %s | %s\n", image_name, name);
207208
fflush(stdout);
208209

209-
if (portability_library_path_ends_with(image_name, name) == 0)
210+
if (portability_library_path_ends_with(image_name, path) == 0)
210211
{
211212
size_t image_length = strnlen(image_name, PORTABILITY_PATH_SIZE);
212213

@@ -222,7 +223,7 @@ int portability_library_path_find(const char name[], portability_library_path_st
222223
*length = image_length;
223224
}
224225

225-
printf("Debug ended with: %s | %s => %s\n", image_name, path, name);
226+
printf("------------------------------- Debug ended with: %s | %s => %s\n", image_name, path, name);
226227
fflush(stdout);
227228

228229
return 0;

0 commit comments

Comments
 (0)