summaryrefslogtreecommitdiff
path: root/usr/src/lib/libc/port/stdio/fputs.c
diff options
context:
space:
mode:
authorRobert Mustacchi <rm@fingolfin.org>2020-03-02 05:43:45 +0000
committerRobert Mustacchi <rm@fingolfin.org>2020-03-26 07:42:53 +0000
commitcd62a92d4a964bfe61d35ba2301b69e65e22a509 (patch)
tree8e346d9037f7c654ffe58ed0d5e27f34025dd672 /usr/src/lib/libc/port/stdio/fputs.c
parent1470234269f4edea4cbf270cb2475e4988b788d5 (diff)
downloadillumos-joyent-cd62a92d4a964bfe61d35ba2301b69e65e22a509.tar.gz
7092 Want support for stdio memory streams
12360 fwrite can loop forever on zero byte write 12392 ftello64 doesn't handle ungetc() correctly when unbuffered Reviewed by: John Levon <john.levon@joyent.com> Reviewed by: Yuri Pankov <ypankov@fastmail.com> Approved by: Dan McDonald <danmcd@joyent.com>
Diffstat (limited to 'usr/src/lib/libc/port/stdio/fputs.c')
-rw-r--r--usr/src/lib/libc/port/stdio/fputs.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/usr/src/lib/libc/port/stdio/fputs.c b/usr/src/lib/libc/port/stdio/fputs.c
index be0f5b4f8f..46b0d87107 100644
--- a/usr/src/lib/libc/port/stdio/fputs.c
+++ b/usr/src/lib/libc/port/stdio/fputs.c
@@ -25,10 +25,7 @@
*/
/* Copyright (c) 1988 AT&T */
-/* All Rights Reserved */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
+/* All Rights Reserved */
/*
* Ptr args aren't checked for NULL because the program would be a
@@ -112,15 +109,13 @@ fputs(const char *ptr, FILE *iop)
return (EOF);
}
}
- }
- else
- {
+ } else {
/* write out to an unbuffered file */
ssize_t num_wrote;
ssize_t count = (ssize_t)ptrlen;
- int fd = GET_FD(iop);
- while ((num_wrote = write(fd, ptr, (size_t)count)) != count) {
+ while ((num_wrote = _xwrite(iop, ptr, (size_t)count)) !=
+ count) {
if (num_wrote <= 0) {
if (!cancel_active())
iop->_flag |= _IOERR;