file creation on f[re]open() was still wrong
This commit is contained in:
parent
09a4136272
commit
a3bd2c6734
2 changed files with 2 additions and 2 deletions
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue