Skip to content

Commit

Permalink
[metadata] add missing MONO_ENTER/EXIT_GC_SAFE guards around access(2…
Browse files Browse the repository at this point in the history
…) in is_file_writable (mono#7126)
  • Loading branch information
blucz authored and luhenry committed Feb 21, 2018
1 parent d2383c0 commit f636486
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion mono/metadata/w32file-unix.c
Original file line number Diff line number Diff line change
Expand Up @@ -893,6 +893,7 @@ static gboolean lock_while_writing = FALSE;
static gboolean
is_file_writable (struct stat *st, const gchar *path)
{
gboolean ret;
#if __APPLE__
// OS X Finder "locked" or `ls -lO` "uchg".
// This only covers one of several cases where an OS X file could be unwritable through special flags.
Expand All @@ -915,7 +916,10 @@ is_file_writable (struct stat *st, const gchar *path)
/* Fallback to using access(2). It's not ideal as it might not take into consideration euid/egid
* but it's the only sane option we have on unix.
*/
return access (path, W_OK) == 0;
MONO_ENTER_GC_SAFE;
ret = access (path, W_OK) == 0;
MONO_EXIT_GC_SAFE;
return ret;
}


Expand Down

0 comments on commit f636486

Please sign in to comment.