summaryrefslogtreecommitdiffstats
path: root/lib/libc/stdio/stdio.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libc/stdio/stdio.c')
-rw-r--r--lib/libc/stdio/stdio.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/lib/libc/stdio/stdio.c b/lib/libc/stdio/stdio.c
index 7899387..852e971 100644
--- a/lib/libc/stdio/stdio.c
+++ b/lib/libc/stdio/stdio.c
@@ -35,7 +35,11 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
+#if 0
static char sccsid[] = "@(#)stdio.c 8.1 (Berkeley) 6/4/93";
+#endif
+static const char rcsid[] =
+ "$Id$";
#endif /* LIBC_SCCS and not lint */
#include <fcntl.h>
@@ -47,6 +51,7 @@ static char sccsid[] = "@(#)stdio.c 8.1 (Berkeley) 6/4/93";
* Small standard I/O/seek/close functions.
* These maintain the `known seek offset' for seek optimisation.
*/
+int
__sread(cookie, buf, n)
void *cookie;
char *buf;
@@ -54,8 +59,8 @@ __sread(cookie, buf, n)
{
register FILE *fp = cookie;
register int ret;
-
- ret = read(fp->_file, buf, n);
+
+ ret = read(fp->_file, buf, (size_t)n);
/* if the read succeeded, update the current offset */
if (ret >= 0)
fp->_offset += ret;
@@ -64,6 +69,7 @@ __sread(cookie, buf, n)
return (ret);
}
+int
__swrite(cookie, buf, n)
void *cookie;
char const *buf;
@@ -74,7 +80,7 @@ __swrite(cookie, buf, n)
if (fp->_flags & __SAPP)
(void) lseek(fp->_file, (off_t)0, SEEK_END);
fp->_flags &= ~__SOFF; /* in case FAPPEND mode is set */
- return (write(fp->_file, buf, n));
+ return (write(fp->_file, buf, (size_t)n));
}
fpos_t
@@ -85,9 +91,9 @@ __sseek(cookie, offset, whence)
{
register FILE *fp = cookie;
register off_t ret;
-
+
ret = lseek(fp->_file, (off_t)offset, whence);
- if (ret == -1L)
+ if (ret == -1)
fp->_flags &= ~__SOFF;
else {
fp->_flags |= __SOFF;
@@ -96,6 +102,7 @@ __sseek(cookie, offset, whence)
return (ret);
}
+int
__sclose(cookie)
void *cookie;
{
OpenPOWER on IntegriCloud