aboutsummaryrefslogtreecommitdiff
path: root/nuttx/binfmt
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2012-12-19 22:18:30 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2012-12-19 22:18:30 +0000
commitdb3e7613bce907bab90a64c297ec420f3b35f7ce (patch)
treed8042aaa7325712cbdc8afaeab8f6928ce915e76 /nuttx/binfmt
parent272fc3b5233e6d3c9e4d9c32a67511868f2c1a9a (diff)
downloadpx4-firmware-db3e7613bce907bab90a64c297ec420f3b35f7ce.tar.gz
px4-firmware-db3e7613bce907bab90a64c297ec420f3b35f7ce.tar.bz2
px4-firmware-db3e7613bce907bab90a64c297ec420f3b35f7ce.zip
Verify PATH variable in apps/examples/elf
git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5445 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/binfmt')
-rw-r--r--nuttx/binfmt/binfmt_exepath.c1
-rw-r--r--nuttx/binfmt/binfmt_loadmodule.c6
-rw-r--r--nuttx/binfmt/binfmt_unloadmodule.c2
-rw-r--r--nuttx/binfmt/libelf/libelf_addrenv.c4
-rw-r--r--nuttx/binfmt/libnxflat/libnxflat_addrenv.c4
5 files changed, 9 insertions, 8 deletions
diff --git a/nuttx/binfmt/binfmt_exepath.c b/nuttx/binfmt/binfmt_exepath.c
index 24903e26d..4fd7ad918 100644
--- a/nuttx/binfmt/binfmt_exepath.c
+++ b/nuttx/binfmt/binfmt_exepath.c
@@ -42,6 +42,7 @@
#include <sys/types.h>
#include <sys/stat.h>
+#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
diff --git a/nuttx/binfmt/binfmt_loadmodule.c b/nuttx/binfmt/binfmt_loadmodule.c
index 8a691edc7..112a6b35b 100644
--- a/nuttx/binfmt/binfmt_loadmodule.c
+++ b/nuttx/binfmt/binfmt_loadmodule.c
@@ -146,11 +146,11 @@ int load_module(FAR struct binary_s *bin)
#endif
{
/* Were we given a relative path? Or an absolute path to the file to
- * be loaded.
+ * be loaded? Absolute paths start with '/'.
*/
#ifdef CONFIG_BINFMT_EXEPATH
- if (bin->filename[0] == '/')
+ if (bin->filename[0] != '/')
{
FAR const char *relpath;
FAR char *fullpath;
@@ -168,7 +168,7 @@ int load_module(FAR struct binary_s *bin)
{
/* Get the next absolute file path */
- while ((fullpath = exepath_next(handle, relpath)))
+ while ((fullpath = exepath_next(handle, relpath)) != NULL)
{
/* Try to load the file at this path */
diff --git a/nuttx/binfmt/binfmt_unloadmodule.c b/nuttx/binfmt/binfmt_unloadmodule.c
index a03b98d6c..365f26a34 100644
--- a/nuttx/binfmt/binfmt_unloadmodule.c
+++ b/nuttx/binfmt/binfmt_unloadmodule.c
@@ -83,7 +83,7 @@
****************************************************************************/
#ifdef CONFIG_BINFMT_CONSTRUCTORS
-static inline void exec_dtors(FAR const struct binary_s *binp)
+static inline int exec_dtors(FAR const struct binary_s *binp)
{
binfmt_dtor_t *dtor = binp->dtors;
#ifdef CONFIG_ADDRENV
diff --git a/nuttx/binfmt/libelf/libelf_addrenv.c b/nuttx/binfmt/libelf/libelf_addrenv.c
index 28cc0e108..193062a54 100644
--- a/nuttx/binfmt/libelf/libelf_addrenv.c
+++ b/nuttx/binfmt/libelf/libelf_addrenv.c
@@ -64,7 +64,7 @@
****************************************************************************/
/****************************************************************************
- * Name: elf_addrenv_create
+ * Name: elf_addrenv_alloc
*
* Description:
* Allocate memory for the ELF image (elfalloc). If CONFIG_ADDRENV=n,
@@ -83,7 +83,7 @@
*
****************************************************************************/
-int elf_addrenv_create(FAR struct elf_loadinfo_s *loadinfo, size_t envsize)
+int elf_addrenv_alloc(FAR struct elf_loadinfo_s *loadinfo, size_t envsize)
{
#ifdef CONFIG_ADDRENV
FAR void *vaddr;
diff --git a/nuttx/binfmt/libnxflat/libnxflat_addrenv.c b/nuttx/binfmt/libnxflat/libnxflat_addrenv.c
index 233713ccd..2d9255b28 100644
--- a/nuttx/binfmt/libnxflat/libnxflat_addrenv.c
+++ b/nuttx/binfmt/libnxflat/libnxflat_addrenv.c
@@ -65,7 +65,7 @@
****************************************************************************/
/****************************************************************************
- * Name: nxflat_addrenv_create
+ * Name: nxflat_addrenv_alloc
*
* Description:
* Allocate memory for the ELF image (elfalloc). If CONFIG_ADDRENV=n,
@@ -84,7 +84,7 @@
*
****************************************************************************/
-int nxflat_addrenv_create(FAR struct nxflat_loadinfo_s *loadinfo, size_t envsize)
+int nxflat_addrenv_alloc(FAR struct nxflat_loadinfo_s *loadinfo, size_t envsize)
{
FAR struct dspace_s *dspace;
#ifdef CONFIG_ADDRENV