file creation on f[re]open() was still wrong

This commit is contained in:
eck 1990-04-09 15:55:51 +00:00
parent 09a4136272
commit a3bd2c6734
2 changed files with 2 additions and 2 deletions

View file

@ -88,7 +88,7 @@ fopen(const char *name, const char *mode)
*/
if ((rwflags & O_TRUNC)
|| (((fd = _open(name, rwmode)) < 0)
&& (flags & _IOWRITE))) {
&& (rwflags & O_CREAT))) {
if (((fd = _creat(name, PMODE)) > 0) && flags | _IOREAD) {
(void) _close(fd);
fd = _open(name, rwmode);

View file

@ -68,7 +68,7 @@ freopen(const char *name, const char *mode, FILE *stream)
if ((rwflags & O_TRUNC)
|| (((fd = _open(name, rwmode)) < 0)
&& (flags & _IOWRITE))) {
&& (rwflags & O_CREAT))) {
if (((fd = _creat(name, PMODE)) < 0) && flags | _IOREAD) {
(void) _close(fd);
fd = _open(name, rwmode);