summaryrefslogtreecommitdiff
path: root/libc/stdio/stdio.c
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2001-04-06 20:28:45 +0000
committerEric Andersen <andersen@codepoet.org>2001-04-06 20:28:45 +0000
commit6278781655261a5011376b2fa2600996e32ca889 (patch)
tree11783e71b36c8c546c4dc02dff355b0f2478978b /libc/stdio/stdio.c
parenta704ccaa5232184844cd67315951b39f85a6ba04 (diff)
Fix include/errno.h to not use kernel header, and instead use bits/errno.h.
This required we use _LIBC instead of __LIBC__ to be consistent with glibc. This had some sideffects in sys/syscalls.h. While fixing things, I made everything use __set_errno() for (eventual) thread support. -Erik
Diffstat (limited to 'libc/stdio/stdio.c')
-rw-r--r--libc/stdio/stdio.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/libc/stdio/stdio.c b/libc/stdio/stdio.c
index fe1c6a073..954318d39 100644
--- a/libc/stdio/stdio.c
+++ b/libc/stdio/stdio.c
@@ -279,7 +279,7 @@ int fflush(FILE *fp)
* ANSI says behavior in this case is undefined but also says you
* shouldn't flush a stream you were reading from.
*/
- errno = EBADF; /* Should we set stream error indicator? */
+ __set_errno(EBADF); /* Should we set stream error indicator? */
rv = -1;
}
@@ -560,7 +560,7 @@ int fseek(FILE *fp, long int offset, int ref)
#endif
if ((ref < 0) || (ref > 2)) {
- errno = EINVAL;
+ __set_errno(EINVAL);
return -1;
}
@@ -610,7 +610,7 @@ FILE *fp;
--pos;
}
if (pos < 0) { /* ungetcs at start of file? */
- errno = EIO;
+ __set_errno(EIO);
pos = -1;
}
}
@@ -666,7 +666,7 @@ const char *mode;
open_mode = (O_WRONLY | O_CREAT | O_APPEND);
break;
default: /* illegal mode */
- errno = EINVAL;
+ __set_errno(EINVAL);
goto _fopen_ERROR;
}
@@ -709,7 +709,7 @@ const char *mode;
fd = -1;
} else if (!(cur_mode & O_RDWR)
&& ((cur_mode ^ open_mode) & O_ACCMODE)) {
- errno = EINVAL;
+ __set_errno(EINVAL);
fd = -1;
}
}
@@ -1037,7 +1037,7 @@ int fgetpos(FILE *fp, fpos_t *pos)
fpos_t p;
if (!pos) { /* NULL pointer. */
- errno = EINVAL;
+ __set_errno(EINVAL);
return -1;
}
@@ -1056,7 +1056,7 @@ int fsetpos(FILE *fp, __const fpos_t *pos)
if (pos) { /* Pointer ok. */
return fseek(fp, *pos, SEEK_SET);
}
- errno = EINVAL; /* NULL pointer. */
+ __set_errno(EINVAL); /* NULL pointer. */
return EOF;
}
#endif