diff options
Diffstat (limited to 'sljit/sljitUtils.c')
-rw-r--r-- | sljit/sljitUtils.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/sljit/sljitUtils.c b/sljit/sljitUtils.c index 6bd17e5..ec5c321 100644 --- a/sljit/sljitUtils.c +++ b/sljit/sljitUtils.c @@ -182,7 +182,10 @@ static pthread_mutex_t dev_zero_mutex = PTHREAD_MUTEX_INITIALIZER; static SLJIT_INLINE sljit_s32 open_dev_zero(void) { pthread_mutex_lock(&dev_zero_mutex); - dev_zero = open("/dev/zero", O_RDWR); + /* The dev_zero might be initialized by another thread during the waiting. */ + if (dev_zero < 0) { + dev_zero = open("/dev/zero", O_RDWR); + } pthread_mutex_unlock(&dev_zero_mutex); return dev_zero < 0; } |