From 462b4baf33fce4b7876c4269f545941d7ec7858a Mon Sep 17 00:00:00 2001 From: Vicent Marti Date: Thu, 23 Feb 2017 16:36:20 +0100 Subject: [PATCH] ruby_setenv: Do not allow on multi-threaded programs --- hash.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/hash.c b/hash.c index 1867c0999c198c..a4f519202f537a 100644 --- a/hash.c +++ b/hash.c @@ -3382,9 +3382,18 @@ check_envname(const char *name) } #endif +static void +check_running_threads(void) +{ + if (!rb_thread_alone()) + rb_raise(rb_eRuntimeError, "cannot setenv() in a multi-threaded program"); +} + void ruby_setenv(const char *name, const char *value) { + check_running_threads(); + #if defined(_WIN32) # if defined(MINGW_HAS_SECURE_API) || RUBY_MSVCRT_VERSION >= 80 # define HAVE__WPUTENV_S 1 pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy