You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by pk...@apache.org on 2022/06/14 07:39:58 UTC

[incubator-nuttx] branch master updated (cf91b403c9 -> dc2b2dcb3f)

This is an automated email from the ASF dual-hosted git repository.

pkarashchenko pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git


    from cf91b403c9 arch: imx6: Enable imx_idle.c to reduce CPU load
     new 1b32fc1642 sched/env: Fix the return value of unsetenv()
     new dc2b2dcb3f sched/env: Check for incoming parameter validity in unsetenv()

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 sched/environ/env_unsetenv.c | 19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)


[incubator-nuttx] 02/02: sched/env: Check for incoming parameter validity in unsetenv()

Posted by pk...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

pkarashchenko pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit dc2b2dcb3f7f4561f880fbbbaa60fab90984ffa4
Author: Ville Juven <vi...@unikie.com>
AuthorDate: Mon Jun 13 15:51:12 2022 +0300

    sched/env: Check for incoming parameter validity in unsetenv()
    
    Something the function did not do, check the incoming parameter is vlaid
---
 sched/environ/env_unsetenv.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/sched/environ/env_unsetenv.c b/sched/environ/env_unsetenv.c
index be491474c4..62f9fd8a99 100644
--- a/sched/environ/env_unsetenv.c
+++ b/sched/environ/env_unsetenv.c
@@ -63,7 +63,15 @@ int unsetenv(FAR const char *name)
   FAR struct task_group_s *group = rtcb->group;
   int idx;
 
-  DEBUGASSERT(name && group);
+  DEBUGASSERT(group);
+
+  /* Check the incoming parameter */
+
+  if (name == NULL || *name == '\0' || strchr(name, '=') != NULL)
+    {
+      set_errno(EINVAL);
+      return ERROR;
+    }
 
   /* Check if the variable exists */
 


[incubator-nuttx] 01/02: sched/env: Fix the return value of unsetenv()

Posted by pk...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

pkarashchenko pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit 1b32fc1642a163b6860c7b2eb9c5a8f60a3b9963
Author: Ville Juven <vi...@unikie.com>
AuthorDate: Mon Jun 13 15:00:44 2022 +0300

    sched/env: Fix the return value of unsetenv()
    
    If the environment variable does not exist, the function succeeds, as
    defined by POSIX.
---
 sched/environ/env_unsetenv.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/sched/environ/env_unsetenv.c b/sched/environ/env_unsetenv.c
index 6d227d0d37..be491474c4 100644
--- a/sched/environ/env_unsetenv.c
+++ b/sched/environ/env_unsetenv.c
@@ -61,23 +61,22 @@ int unsetenv(FAR const char *name)
 {
   FAR struct tcb_s *rtcb = this_task();
   FAR struct task_group_s *group = rtcb->group;
-  int ret = OK;
+  int idx;
 
   DEBUGASSERT(name && group);
 
   /* Check if the variable exists */
 
   sched_lock();
-  if (group && (ret = env_findvar(group, name)) >= 0)
+  if (group && (idx = env_findvar(group, name)) >= 0)
     {
       /* It does!  Remove the name=value pair from the environment. */
 
-      env_removevar(group, ret);
-      ret = OK;
+      env_removevar(group, idx);
     }
 
   sched_unlock();
-  return ret;
+  return OK;
 }
 
 #endif /* CONFIG_DISABLE_ENVIRON */