Skip to content

Commit

Permalink
Use the system getenv in setup_debug_log
Browse files Browse the repository at this point in the history
As ruby_set_debug_option() is called before ruby_sysinit(),
CRITICAL_SECTIONs are not initialized yet.
  • Loading branch information
nobu committed Feb 23, 2021
1 parent 819dd46 commit 7563d54
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,7 @@ ruby_set_debug_option(const char *str)
}

#if RUBY_DEVEL
#undef getenv

// RUBY_DEBUG_LOG features
// See vm_debug.h comments for details.
Expand Down
2 changes: 1 addition & 1 deletion win32/win32.c
Original file line number Diff line number Diff line change
Expand Up @@ -811,7 +811,6 @@ StartSockets(void)
InitializeCriticalSection(&select_mutex);
InitializeCriticalSection(&socklist_mutex);
InitializeCriticalSection(&conlist_mutex);
InitializeCriticalSection(&uenvarea_mutex);

atexit(exit_handler);
}
Expand Down Expand Up @@ -896,6 +895,7 @@ rb_w32_sysinit(int *argc, char ***argv)
#endif
SetErrorMode(SEM_FAILCRITICALERRORS|SEM_NOGPFAULTERRORBOX);

InitializeCriticalSection(&uenvarea_mutex);
get_version();

//
Expand Down

0 comments on commit 7563d54

Please sign in to comment.