summaryrefslogtreecommitdiff
path: root/nuttx/lib/stdio
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2011-04-02 15:25:22 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2011-04-02 15:25:22 +0000
commit68551d0cf274eacbf5c6de959e7bf812a6ee7eba (patch)
treea26751e5f0991b18a587dbc2d37c6ee7c3ce847d /nuttx/lib/stdio
parent158978359318cb94de9e08900af4300bdfa5f651 (diff)
downloadpx4-nuttx-68551d0cf274eacbf5c6de959e7bf812a6ee7eba.tar.gz
px4-nuttx-68551d0cf274eacbf5c6de959e7bf812a6ee7eba.tar.bz2
px4-nuttx-68551d0cf274eacbf5c6de959e7bf812a6ee7eba.zip
Kernel build mostly successful
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3454 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/lib/stdio')
-rw-r--r--nuttx/lib/stdio/lib_fgetpos.c2
-rw-r--r--nuttx/lib/stdio/lib_fileno.c2
-rw-r--r--nuttx/lib/stdio/lib_fopen.c2
-rw-r--r--nuttx/lib/stdio/lib_fputs.c2
-rw-r--r--nuttx/lib/stdio/lib_fseek.c2
-rw-r--r--nuttx/lib/stdio/lib_fsetpos.c2
-rw-r--r--nuttx/lib/stdio/lib_ftell.c2
-rw-r--r--nuttx/lib/stdio/lib_libfflush.c2
-rw-r--r--nuttx/lib/stdio/lib_libflushall.c7
-rw-r--r--nuttx/lib/stdio/lib_libfread.c2
-rw-r--r--nuttx/lib/stdio/lib_libfwrite.c2
-rw-r--r--nuttx/lib/stdio/lib_rawinstream.c2
-rw-r--r--nuttx/lib/stdio/lib_rawoutstream.c2
-rw-r--r--nuttx/lib/stdio/lib_rdflush.c2
-rw-r--r--nuttx/lib/stdio/lib_ungetc.c4
15 files changed, 20 insertions, 17 deletions
diff --git a/nuttx/lib/stdio/lib_fgetpos.c b/nuttx/lib/stdio/lib_fgetpos.c
index a641db481..af07f7387 100644
--- a/nuttx/lib/stdio/lib_fgetpos.c
+++ b/nuttx/lib/stdio/lib_fgetpos.c
@@ -107,7 +107,7 @@ int fgetpos(FAR FILE *stream, FAR fpos_t *pos)
#if CONFIG_DEBUG
if (!stream || !pos)
{
- errno = EINVAL;
+ set_errno(EINVAL);
return ERROR;
}
#endif
diff --git a/nuttx/lib/stdio/lib_fileno.c b/nuttx/lib/stdio/lib_fileno.c
index 2fe3d9c99..7366194ba 100644
--- a/nuttx/lib/stdio/lib_fileno.c
+++ b/nuttx/lib/stdio/lib_fileno.c
@@ -60,7 +60,7 @@ int fileno(FAR FILE *stream)
if (ret < 0)
{
- errno = EBADF;
+ set_errno(EBADF);
return ERROR;
}
return ret;
diff --git a/nuttx/lib/stdio/lib_fopen.c b/nuttx/lib/stdio/lib_fopen.c
index 07437161c..42ac19d1b 100644
--- a/nuttx/lib/stdio/lib_fopen.c
+++ b/nuttx/lib/stdio/lib_fopen.c
@@ -230,7 +230,7 @@ errout_with_sem:
stream_semgive(slist);
errout:
- *get_errno_ptr() = err;
+ set_errno(err);
return NULL;
}
diff --git a/nuttx/lib/stdio/lib_fputs.c b/nuttx/lib/stdio/lib_fputs.c
index 870c5c42e..54801ca50 100644
--- a/nuttx/lib/stdio/lib_fputs.c
+++ b/nuttx/lib/stdio/lib_fputs.c
@@ -100,7 +100,7 @@ int fputs(FAR const char *s, FAR FILE *stream)
if (!s)
{
- *get_errno_ptr() = EINVAL;
+ set_errno(EINVAL);
}
else
{
diff --git a/nuttx/lib/stdio/lib_fseek.c b/nuttx/lib/stdio/lib_fseek.c
index e56645ab6..a68de79fe 100644
--- a/nuttx/lib/stdio/lib_fseek.c
+++ b/nuttx/lib/stdio/lib_fseek.c
@@ -119,7 +119,7 @@ int fseek(FAR FILE *stream, long int offset, int whence)
if (!stream)
{
- errno = EBADF;
+ set_errno(EBADF);
return ERROR;
}
#endif
diff --git a/nuttx/lib/stdio/lib_fsetpos.c b/nuttx/lib/stdio/lib_fsetpos.c
index 637c627b5..ad3e67230 100644
--- a/nuttx/lib/stdio/lib_fsetpos.c
+++ b/nuttx/lib/stdio/lib_fsetpos.c
@@ -107,7 +107,7 @@ int fsetpos(FAR FILE *stream, FAR fpos_t *pos)
#if CONFIG_DEBUG
if (!stream || !pos)
{
- errno = EINVAL;
+ set_errno(EINVAL);
return ERROR;
}
#endif
diff --git a/nuttx/lib/stdio/lib_ftell.c b/nuttx/lib/stdio/lib_ftell.c
index b0b0a78e5..cd0e48368 100644
--- a/nuttx/lib/stdio/lib_ftell.c
+++ b/nuttx/lib/stdio/lib_ftell.c
@@ -107,7 +107,7 @@ long ftell(FAR FILE *stream)
if (!stream)
{
- errno = EBADF;
+ set_errno(EBADF);
return ERROR;
}
diff --git a/nuttx/lib/stdio/lib_libfflush.c b/nuttx/lib/stdio/lib_libfflush.c
index 68a1bc39f..3e9de538a 100644
--- a/nuttx/lib/stdio/lib_libfflush.c
+++ b/nuttx/lib/stdio/lib_libfflush.c
@@ -114,7 +114,7 @@ ssize_t lib_fflush(FAR FILE *stream, bool bforce)
if (stream->fs_filedes < 0 || (stream->fs_oflags & O_WROK) == 0)
{
- *get_errno_ptr() = EBADF;
+ set_errno(EBADF);
return ERROR;
}
diff --git a/nuttx/lib/stdio/lib_libflushall.c b/nuttx/lib/stdio/lib_libflushall.c
index de2853df8..0b95fc22d 100644
--- a/nuttx/lib/stdio/lib_libflushall.c
+++ b/nuttx/lib/stdio/lib_libflushall.c
@@ -121,7 +121,7 @@ int lib_flushall(FAR struct streamlist *list)
* to flush all of the buffered write data. Return EOF on failure.
*/
- lasterrno = *get_errno_ptr();
+ lasterrno = get_errno();
ret = ERROR;
}
}
@@ -131,6 +131,9 @@ int lib_flushall(FAR struct streamlist *list)
/* If any flush failed, return that last failed flush */
- *get_errno_ptr() = lasterrno;
+ if (ret != OK)
+ {
+ set_errno(lasterrno);
+ }
return ret;
}
diff --git a/nuttx/lib/stdio/lib_libfread.c b/nuttx/lib/stdio/lib_libfread.c
index abeb34deb..4d402a42b 100644
--- a/nuttx/lib/stdio/lib_libfread.c
+++ b/nuttx/lib/stdio/lib_libfread.c
@@ -93,7 +93,7 @@ ssize_t lib_fread(FAR void *ptr, size_t count, FAR FILE *stream)
if (!stream || (stream->fs_oflags & O_RDOK) == 0)
{
- *get_errno_ptr() = EBADF;
+ set_errno(EBADF);
bytes_read = -1;
}
else
diff --git a/nuttx/lib/stdio/lib_libfwrite.c b/nuttx/lib/stdio/lib_libfwrite.c
index 3b7253cdd..e2c35e3e9 100644
--- a/nuttx/lib/stdio/lib_libfwrite.c
+++ b/nuttx/lib/stdio/lib_libfwrite.c
@@ -96,7 +96,7 @@ ssize_t lib_fwrite(FAR const void *ptr, size_t count, FAR FILE *stream)
if (!stream || (stream->fs_oflags & O_WROK) == 0)
{
- *get_errno_ptr() = EBADF;
+ set_errno(EBADF);
goto errout;
}
diff --git a/nuttx/lib/stdio/lib_rawinstream.c b/nuttx/lib/stdio/lib_rawinstream.c
index b54305ce6..ead3116b4 100644
--- a/nuttx/lib/stdio/lib_rawinstream.c
+++ b/nuttx/lib/stdio/lib_rawinstream.c
@@ -66,7 +66,7 @@ static int rawinstream_getc(FAR struct lib_instream_s *this)
return ch;
}
}
- while (nwritten < 0 && errno == EINTR);
+ while (nwritten < 0 && get_errno() == EINTR);
}
return EOF;
diff --git a/nuttx/lib/stdio/lib_rawoutstream.c b/nuttx/lib/stdio/lib_rawoutstream.c
index bf9a68206..05cb5853f 100644
--- a/nuttx/lib/stdio/lib_rawoutstream.c
+++ b/nuttx/lib/stdio/lib_rawoutstream.c
@@ -64,7 +64,7 @@ static void rawoutstream_putc(FAR struct lib_outstream_s *this, int ch)
this->nput++;
}
}
- while (nwritten < 0 && *get_errno_ptr() == EINTR);
+ while (nwritten < 0 && get_errno() == EINTR);
}
}
diff --git a/nuttx/lib/stdio/lib_rdflush.c b/nuttx/lib/stdio/lib_rdflush.c
index 592cc4183..948dcce5d 100644
--- a/nuttx/lib/stdio/lib_rdflush.c
+++ b/nuttx/lib/stdio/lib_rdflush.c
@@ -96,7 +96,7 @@ int lib_rdflush(FAR FILE *stream)
{
if (!stream)
{
- *get_errno_ptr() = EBADF;
+ set_errno(EBADF);
return ERROR;
}
diff --git a/nuttx/lib/stdio/lib_ungetc.c b/nuttx/lib/stdio/lib_ungetc.c
index 9ad72b394..e27428fa4 100644
--- a/nuttx/lib/stdio/lib_ungetc.c
+++ b/nuttx/lib/stdio/lib_ungetc.c
@@ -99,7 +99,7 @@ int ungetc(int c, FAR FILE *stream)
if ((stream && stream->fs_filedes < 0) ||
((stream->fs_oflags & O_RDOK) == 0))
{
- errno = EBADF;
+ set_errno(EBADF);
return EOF;
}
@@ -114,7 +114,7 @@ int ungetc(int c, FAR FILE *stream)
else
#endif
{
- errno = ENOMEM;
+ set_errno(ENOMEM);
return EOF;
}
}