mirror of
https://github.com/apache/nuttx.git
synced 2026-05-28 20:08:15 +08:00
libc/environ: add interrupt context check to getenv
Prevent getenv() from being called in interrupt context by adding up_interrupt_context() check. This ensures thread-safe access to environment variables in multi-threaded scenarios. Signed-off-by: hujun5 <hujun5@xiaomi.com>
This commit is contained in:
@@ -67,7 +67,7 @@ FAR char *getenv(FAR const char *name)
|
|||||||
|
|
||||||
/* Verify that a string was passed */
|
/* Verify that a string was passed */
|
||||||
|
|
||||||
if (name == NULL)
|
if (name == NULL || up_interrupt_context())
|
||||||
{
|
{
|
||||||
ret = -EINVAL;
|
ret = -EINVAL;
|
||||||
goto errout;
|
goto errout;
|
||||||
|
|||||||
Reference in New Issue
Block a user