From 93496f056d8dfeaa109df6a8ec9654829d415493 Mon Sep 17 00:00:00 2001 From: Philip Guenthe Date: Sat, 21 Nov 2009 09:53:45 +0000 Subject: Several stdio functions were failing to set the stream orientation to 'narrow' as they should. "looks correct" millert@ "makes sense" blambert@ --- lib/libc/stdio/fgetln.c | 3 ++- lib/libc/stdio/fread.c | 3 ++- lib/libc/stdio/fwrite.c | 3 ++- lib/libc/stdio/putc.c | 5 +++-- lib/libc/stdio/puts.c | 3 ++- lib/libc/stdio/putw.c | 3 ++- 6 files changed, 13 insertions(+), 7 deletions(-) (limited to 'lib/libc/stdio') diff --git a/lib/libc/stdio/fgetln.c b/lib/libc/stdio/fgetln.c index 0ec02230689..539b3c081cd 100644 --- a/lib/libc/stdio/fgetln.c +++ b/lib/libc/stdio/fgetln.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fgetln.c,v 1.10 2009/11/09 00:18:27 kurt Exp $ */ +/* $OpenBSD: fgetln.c,v 1.11 2009/11/21 09:53:44 guenther Exp $ */ /*- * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. @@ -76,6 +76,7 @@ fgetln(FILE *fp, size_t *lenp) size_t off; FLOCKFILE(fp); + _SET_ORIENTATION(fp, -1); /* make sure there is input */ if (fp->_r <= 0 && __srefill(fp)) diff --git a/lib/libc/stdio/fread.c b/lib/libc/stdio/fread.c index cb6714e1d06..430865d022f 100644 --- a/lib/libc/stdio/fread.c +++ b/lib/libc/stdio/fread.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fread.c,v 1.10 2009/11/09 00:18:27 kurt Exp $ */ +/* $OpenBSD: fread.c,v 1.11 2009/11/21 09:53:44 guenther Exp $ */ /*- * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. @@ -49,6 +49,7 @@ fread(void *buf, size_t size, size_t count, FILE *fp) if ((resid = count * size) == 0) return (0); FLOCKFILE(fp); + _SET_ORIENTATION(fp, -1); if (fp->_r < 0) fp->_r = 0; total = resid; diff --git a/lib/libc/stdio/fwrite.c b/lib/libc/stdio/fwrite.c index 1e5f0745dfa..41784f9312a 100644 --- a/lib/libc/stdio/fwrite.c +++ b/lib/libc/stdio/fwrite.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fwrite.c,v 1.9 2009/11/09 00:18:27 kurt Exp $ */ +/* $OpenBSD: fwrite.c,v 1.10 2009/11/21 09:53:44 guenther Exp $ */ /*- * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. @@ -64,6 +64,7 @@ fwrite(const void *buf, size_t size, size_t count, FILE *fp) * generally slow and since this occurs whenever size==0. */ FLOCKFILE(fp); + _SET_ORIENTATION(fp, -1); ret = __sfvwrite(fp, &uio); FUNLOCKFILE(fp); if (ret == 0) diff --git a/lib/libc/stdio/putc.c b/lib/libc/stdio/putc.c index f0a6ea91081..9461aa90aae 100644 --- a/lib/libc/stdio/putc.c +++ b/lib/libc/stdio/putc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: putc.c,v 1.10 2009/11/09 00:18:27 kurt Exp $ */ +/* $OpenBSD: putc.c,v 1.11 2009/11/21 09:53:44 guenther Exp $ */ /*- * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. @@ -47,6 +47,7 @@ putc_unlocked(int c, FILE *fp) errno = EBADF; return (EOF); } + _SET_ORIENTATION(fp, -1); return (__sputc(c, fp)); } @@ -56,7 +57,7 @@ putc_unlocked(int c, FILE *fp) #undef putc int -putc(int c, FILE *fp) +fputc(int c, FILE *fp) { int ret; diff --git a/lib/libc/stdio/puts.c b/lib/libc/stdio/puts.c index d909be9fe9f..655aed7ec9d 100644 --- a/lib/libc/stdio/puts.c +++ b/lib/libc/stdio/puts.c @@ -1,4 +1,4 @@ -/* $OpenBSD: puts.c,v 1.10 2009/11/09 00:18:27 kurt Exp $ */ +/* $OpenBSD: puts.c,v 1.11 2009/11/21 09:53:44 guenther Exp $ */ /*- * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. @@ -55,6 +55,7 @@ puts(const char *s) uio.uio_iov = &iov[0]; uio.uio_iovcnt = 2; FLOCKFILE(stdout); + _SET_ORIENTATION(stdout, -1); ret = __sfvwrite(stdout, &uio); FUNLOCKFILE(stdout); return (ret ? EOF : '\n'); diff --git a/lib/libc/stdio/putw.c b/lib/libc/stdio/putw.c index fb6d5d8ae87..47941a476c1 100644 --- a/lib/libc/stdio/putw.c +++ b/lib/libc/stdio/putw.c @@ -1,4 +1,4 @@ -/* $OpenBSD: putw.c,v 1.9 2009/11/09 00:18:27 kurt Exp $ */ +/* $OpenBSD: putw.c,v 1.10 2009/11/21 09:53:44 guenther Exp $ */ /*- * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. @@ -47,6 +47,7 @@ putw(int w, FILE *fp) uio.uio_iov = &iov; uio.uio_iovcnt = 1; FLOCKFILE(fp); + _SET_ORIENTATION(fp, -1); ret = __sfvwrite(fp, &uio); FUNLOCKFILE(fp); return (ret); -- cgit v1.2.3