Thread View: net.bugs.usg
1 messages
1 total messages
Started by Bruce Robertson
Wed, 26 Mar 1986 05:47
Bug in SVR2V2 doprnt.c, FIX
Author: Bruce Robertson
Date: Wed, 26 Mar 1986 05:47
Date: Wed, 26 Mar 1986 05:47
57 lines
2425 bytes
2425 bytes
Description:
There is a bug in the doprnt() function for System V, Release 2,
Version 2. doprnt() does its own interfacing to the stdio
data structures, rather than using fwrite() and/or putc(). When
writing to a FILE stream, it is the responsibility of whoever
is going to manipulate the data structures to use the _WRTCHK
macro to insure that an I/O buffer is allocated on the stream.
doprnt() fails to do this.
Repeat-By:
Occasionally, redirecting output of a program that does nothing
but printf()'s to a file will cause the program to core dump.
Fix:
*** /usr/src/lib/libc/port/print/doprnt.c-old Tue Mar 25 21:26:22 1986
--- /usr/src/lib/libc/port/print/doprnt.c Tue Mar 25 21:26:25 1986
***************
*** 9,14
#include <varargs.h>
#include <values.h>
#include "print.h" /* parameters & macros for doprnt */
#define PUT(p, n) { register unsigned char *newbufptr; \
if ((newbufptr = bufptr + n) > bufferend) { \
--- 9,15 -----
#include <varargs.h>
#include <values.h>
#include "print.h" /* parameters & macros for doprnt */
+ #include "../stdio/stdiom.h"
#define PUT(p, n) { register unsigned char *newbufptr; \
if ((newbufptr = bufptr + n) > bufferend) { \
***************
*** 153,158
/* initialize buffer pointer and buffer end pointer */
{ register int fno = iop->_file;
bufptr = iop->_ptr;
bufferend = (fno == _NFILE) ?
(unsigned char *)((long) bufptr | (-1L & ~HIBITL))
--- 154,161 -----
/* initialize buffer pointer and buffer end pointer */
{ register int fno = iop->_file;
+ if (_WRTCHK(iop))
+ return EOF;
bufptr = iop->_ptr;
bufferend = (fno == _NFILE) ?
(unsigned char *)((long) bufptr | (-1L & ~HIBITL))
--
Bruce Robertson
UUCP: cbosgd!utah-cs!utah-gr!stride!bruce
ARPA: stride!bruce@utah-gr.arpa
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads