diff options
Diffstat (limited to 'nuttx/binfmt/libnxflat')
-rw-r--r-- | nuttx/binfmt/libnxflat/Kconfig | 5 | ||||
-rw-r--r-- | nuttx/binfmt/libnxflat/libnxflat_init.c | 7 | ||||
-rw-r--r-- | nuttx/binfmt/libnxflat/libnxflat_read.c | 14 | ||||
-rw-r--r-- | nuttx/binfmt/libnxflat/libnxflat_uninit.c | 7 | ||||
-rw-r--r-- | nuttx/binfmt/libnxflat/libnxflat_verify.c | 9 |
5 files changed, 24 insertions, 18 deletions
diff --git a/nuttx/binfmt/libnxflat/Kconfig b/nuttx/binfmt/libnxflat/Kconfig index ae2bf3130..fdb270cfb 100644 --- a/nuttx/binfmt/libnxflat/Kconfig +++ b/nuttx/binfmt/libnxflat/Kconfig @@ -2,3 +2,8 @@ # For a description of the syntax of this configuration file, # see misc/tools/kconfig-language.txt. # + +config NXFLAT_DUMPBUFFER + bool "Dump NXFLAT buffers" + default n + depends on DEBUG && DEBUG_VERBOSE diff --git a/nuttx/binfmt/libnxflat/libnxflat_init.c b/nuttx/binfmt/libnxflat/libnxflat_init.c index 5b6375ff1..b7cac8d86 100644 --- a/nuttx/binfmt/libnxflat/libnxflat_init.c +++ b/nuttx/binfmt/libnxflat/libnxflat_init.c @@ -48,7 +48,7 @@ #include <errno.h> #include <arpa/inet.h> -#include <nuttx/nxflat.h> +#include <nuttx/binfmt/nxflat.h> /**************************************************************************** * Pre-Processor Definitions @@ -112,8 +112,9 @@ int nxflat_init(const char *filename, struct nxflat_loadinfo_s *loadinfo) loadinfo->filfd = open(filename, O_RDONLY); if (loadinfo->filfd < 0) { - bdbg("Failed to open NXFLAT binary %s: %d\n", filename, ret); - return -errno; + int errval = errno; + bdbg("Failed to open NXFLAT binary %s: %d\n", filename, errval); + return -errval; } /* Read the NXFLAT header from offset 0 */ diff --git a/nuttx/binfmt/libnxflat/libnxflat_read.c b/nuttx/binfmt/libnxflat/libnxflat_read.c index dbcd54279..8deeb0805 100644 --- a/nuttx/binfmt/libnxflat/libnxflat_read.c +++ b/nuttx/binfmt/libnxflat/libnxflat_read.c @@ -48,7 +48,7 @@ #include <errno.h> #include <arpa/inet.h> -#include <nuttx/nxflat.h> +#include <nuttx/binfmt/nxflat.h> /**************************************************************************** * Pre-Processor Definitions @@ -129,8 +129,9 @@ int nxflat_read(struct nxflat_loadinfo_s *loadinfo, char *buffer, int readsize, rpos = lseek(loadinfo->filfd, offset, SEEK_SET); if (rpos != offset) { - bdbg("Failed to seek to position %d: %d\n", offset, errno); - return -errno; + int errval = errno; + bdbg("Failed to seek to position %d: %d\n", offset, errval); + return -errval; } /* Read the file data at offset into the user buffer */ @@ -138,10 +139,11 @@ int nxflat_read(struct nxflat_loadinfo_s *loadinfo, char *buffer, int readsize, nbytes = read(loadinfo->filfd, bufptr, bytesleft); if (nbytes < 0) { - if (errno != EINTR) + int errval = errno; + if (errval != EINTR) { - bdbg("Read of .data failed: %d\n", errno); - return -errno; + bdbg("Read of .data failed: %d\n", errval); + return -errval; } } else if (nbytes == 0) diff --git a/nuttx/binfmt/libnxflat/libnxflat_uninit.c b/nuttx/binfmt/libnxflat/libnxflat_uninit.c index 5d06296c7..b9715196b 100644 --- a/nuttx/binfmt/libnxflat/libnxflat_uninit.c +++ b/nuttx/binfmt/libnxflat/libnxflat_uninit.c @@ -42,7 +42,8 @@ #include <unistd.h> #include <debug.h> #include <errno.h> -#include <nuttx/nxflat.h> + +#include <nuttx/binfmt/nxflat.h> /**************************************************************************** * Pre-Processor Definitions @@ -57,10 +58,6 @@ ****************************************************************************/ /**************************************************************************** - * Name: nxflat_swap32 - ****************************************************************************/ - -/**************************************************************************** * Public Functions ****************************************************************************/ diff --git a/nuttx/binfmt/libnxflat/libnxflat_verify.c b/nuttx/binfmt/libnxflat/libnxflat_verify.c index f799aca4f..20af5d2f7 100644 --- a/nuttx/binfmt/libnxflat/libnxflat_verify.c +++ b/nuttx/binfmt/libnxflat/libnxflat_verify.c @@ -42,8 +42,9 @@ #include <string.h> #include <debug.h> #include <errno.h> + #include <arpa/inet.h> -#include <nuttx/nxflat.h> +#include <nuttx/binfmt/nxflat.h> /**************************************************************************** * Pre-processor Definitions @@ -91,10 +92,10 @@ int nxflat_verifyheader(const struct nxflat_hdr_s *header) if (strncmp(header->h_magic, NXFLAT_MAGIC, 4) != 0) { bdbg("Unrecognized magic=\"%c%c%c%c\"\n", - header->h_magic[0], header->h_magic[1], - header->h_magic[2], header->h_magic[3]); + header->h_magic[0], header->h_magic[1], + header->h_magic[2], header->h_magic[3]); return -ENOEXEC; } + return OK; } - |