diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2007-06-30 22:39:20 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2007-06-30 22:39:20 +0000 |
commit | 20d181a49020ddfa4a2ffde4b341be29d1e90efe (patch) | |
tree | 5c1c90b4c03a2db1f3b93e6c6c80dd2df0d966b3 /nuttx/sched | |
parent | f7e1590c5e290f640f1f2f5bda93be265ed87eb5 (diff) | |
download | px4-nuttx-20d181a49020ddfa4a2ffde4b341be29d1e90efe.tar.gz px4-nuttx-20d181a49020ddfa4a2ffde4b341be29d1e90efe.tar.bz2 px4-nuttx-20d181a49020ddfa4a2ffde4b341be29d1e90efe.zip |
Add environment variable test; fix several detected bugs
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@298 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/sched')
-rw-r--r-- | nuttx/sched/env_dup.c | 4 | ||||
-rw-r--r-- | nuttx/sched/env_getenv.c | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/nuttx/sched/env_dup.c b/nuttx/sched/env_dup.c index 0ee1cbc81..671b8ea7b 100644 --- a/nuttx/sched/env_dup.c +++ b/nuttx/sched/env_dup.c @@ -99,7 +99,7 @@ int env_dup(FAR _TCB *ptcb) { /* Yes..The parent task has an environment, duplicate it */ - size_t envlen = ptcb->envp->ev_alloc; + size_t envlen = parent->envp->ev_alloc; envp = (environ_t*)malloc(SIZEOF_ENVIRON_T( envlen )); if (!envp) { @@ -109,7 +109,7 @@ int env_dup(FAR _TCB *ptcb) { envp->ev_crefs = 1; envp->ev_alloc = envlen; - memcmp( envp->ev_env, ptcb->envp->ev_env, envlen ); + memcpy( envp->ev_env, parent->envp->ev_env, envlen ); } } diff --git a/nuttx/sched/env_getenv.c b/nuttx/sched/env_getenv.c index a1de739a9..91e974845 100644 --- a/nuttx/sched/env_getenv.c +++ b/nuttx/sched/env_getenv.c @@ -100,7 +100,7 @@ FAR char *getenv(const char *name) /* Check if the variable exists */ - if ( envp && (pvar = env_findvar(envp, name)) != NULL) + if ( !envp || (pvar = env_findvar(envp, name)) == NULL) { ret = ENOENT; goto errout_with_lock; |