Skip to content

Commit

Permalink
Allow core dump on OSX to change directories
Browse files Browse the repository at this point in the history
Core dump utility would previously ignore the directory portions of the path.

Signed-off-by: Mike Zhang <mike.h.zhang@ibm.com>
  • Loading branch information
mikezhang1234567890 committed Sep 23, 2021
1 parent 12f1e39 commit d61d967
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions port/osx/omrosdump.c
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,15 @@ omrdump_create(struct OMRPortLibrary *portLibrary, char *filename, char *dumpTyp
mach_error("failed get special port:\n", kr);
return kr;
}
/* Move to specified folder before dumping */
if (NULL != lastSep) {
/* keep separator for cases such as when the path is '/' */
lastSep[1] = '\0';
if (0 != chdir(filename)) {
perror("failed to change directories for dump");
return KERN_FAILURE;
}
}
kr = coredump_to_file(pass_port, parent_pid);
raise(SIGKILL); /* kill child process without running any exit procedures */
} else if (child_pid < 0) { /* fork failed */
Expand Down

0 comments on commit d61d967

Please sign in to comment.