projects
/
unix-history
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
tags
|
clone url
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
BSD 4_1_snap release
[unix-history]
/
usr
/
src
/
libc
/
stdio
/
fdopen.c
diff --git
a/usr/src/libc/stdio/fdopen.c
b/usr/src/libc/stdio/fdopen.c
index
d47ad5f
..
7ebf10b
100644
(file)
--- a/
usr/src/libc/stdio/fdopen.c
+++ b/
usr/src/libc/stdio/fdopen.c
@@
-1,3
+1,4
@@
+/* @(#)fdopen.c 4.2 (Berkeley) 3/9/81 */
/*
* Unix routine to do an "fopen" on file descriptor
* The mode has to be repeated because you can't query its
/*
* Unix routine to do an "fopen" on file descriptor
* The mode has to be repeated because you can't query its
@@
-15,7
+16,7
@@
register char *mode;
register FILE *iop;
extern FILE *_lastbuf;
register FILE *iop;
extern FILE *_lastbuf;
- for (iop = _iob; iop->_flag&(_IOREAD|_IOWRT); iop++)
+ for (iop = _iob; iop->_flag&(_IOREAD|_IOWRT
|_IORW
); iop++)
if (iop >= _lastbuf)
return(NULL);
iop->_cnt = 0;
if (iop >= _lastbuf)
return(NULL);
iop->_cnt = 0;
@@
-26,5
+27,9
@@
register char *mode;
lseek(fd, 0L, 2);
} else
iop->_flag |= _IOREAD;
lseek(fd, 0L, 2);
} else
iop->_flag |= _IOREAD;
+ if (mode[1] == '+') {
+ iop->_flag &= ~(_IOREAD|_IOWRT);
+ iop->_flag |= _IORW;
+ }
return(iop);
}
return(iop);
}