aboutsummaryrefslogtreecommitdiff
path: root/nuttx/binfmt/libnxflat/libnxflat_read.c
diff options
context:
space:
mode:
Diffstat (limited to 'nuttx/binfmt/libnxflat/libnxflat_read.c')
-rw-r--r--nuttx/binfmt/libnxflat/libnxflat_read.c14
1 files changed, 8 insertions, 6 deletions
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)