Skip to content

Commit

Permalink
i#58 MacOS: for the Mach-O module name "module_name", ensure it's a
Browse files Browse the repository at this point in the history
basename and not a full path.

SVN-Revision: 2530
  • Loading branch information
derekbruening committed Feb 19, 2014
1 parent 92a70aa commit 8cf6c96
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions core/unix/module_macho.c
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,12 @@ module_walk_program_headers(app_pc base, size_t view_size, bool at_map,
struct dylib_command *dy = (struct dylib_command *) cmd;
char *soname = (char *)cmd + dy->dylib.name.offset;
/* XXX: we assume these strings are always null-terminated */
/* They seem to have full paths on Mac. We drop to basename, as
* that's what many clients expect for module_name.
*/
char *slash = strrchr(soname, '/');
if (slash != NULL)
soname = slash + 1;
LOG(GLOBAL, LOG_VMAREAS, 4, "%s: lib identity %s\n", __FUNCTION__, soname);
if (out_soname != NULL)
*out_soname = soname;
Expand Down

0 comments on commit 8cf6c96

Please sign in to comment.