summaryrefslogtreecommitdiff
path: root/nuttx/sched/env_unsetenv.c
diff options
context:
space:
mode:
Diffstat (limited to 'nuttx/sched/env_unsetenv.c')
-rw-r--r--nuttx/sched/env_unsetenv.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/nuttx/sched/env_unsetenv.c b/nuttx/sched/env_unsetenv.c
index f397eab6b..a751661c7 100644
--- a/nuttx/sched/env_unsetenv.c
+++ b/nuttx/sched/env_unsetenv.c
@@ -1,7 +1,7 @@
/****************************************************************************
* sched/env_unsetenv.c
*
- * Copyright (C) 2007, 2009 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2007, 2009, 2011 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@@ -43,9 +43,10 @@
#include <sched.h>
#include <string.h>
-#include <stdlib.h>
#include <errno.h>
+#include <nuttx/kmalloc.h>
+
#include "os_internal.h"
#include "env_internal.h"
@@ -109,7 +110,7 @@ int unsetenv(const char *name)
/* Reallocate the new environment buffer */
alloc = envp->ev_alloc;
- tmp = (environ_t*)realloc(envp, SIZEOF_ENVIRON_T(alloc));
+ tmp = (environ_t*)krealloc(envp, SIZEOF_ENVIRON_T(alloc));
if (!tmp)
{
ret = ENOMEM;
@@ -127,7 +128,7 @@ int unsetenv(const char *name)
errout_with_lock:
sched_unlock();
errout:
- *get_errno_ptr() = ret;
+ errno = ret;
return ERROR;
}