mirror of
https://github.com/apache/nuttx.git
synced 2026-05-22 05:42:05 +08:00
env_dup: Fix copying of env between address environments
If address environments are in use, it is not possible to simply memcpy from from one process to another. The current implementation of env_dup does precisely this and thus, it fails at once when it is attempted between two user processes. The solution is to use the kernel's heap as an intermediate buffer. This is a simple, effective and common way to do a fork(). Obviously this is not needed for kernel processes.
This commit is contained in:
@@ -138,7 +138,11 @@ void arc4random_buf(FAR void *bytes, size_t nbytes);
|
||||
|
||||
/* Environment variable support */
|
||||
|
||||
#ifdef CONFIG_DISABLE_ENVIRON
|
||||
# define get_environ_ptr() NULL
|
||||
#else
|
||||
FAR char **get_environ_ptr(void);
|
||||
#endif
|
||||
FAR char *getenv(FAR const char *name);
|
||||
int putenv(FAR const char *string);
|
||||
int clearenv(void);
|
||||
|
||||
Reference in New Issue
Block a user