This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
[gfortran] patch for PR 16196, error on OPEN(...STATUS='REPLACE')
- From: Bud Davis <bdavis at gcc dot gnu dot org>
- To: "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>, gfortran <fortran at gcc dot gnu dot org>
- Date: Fri, 25 Jun 2004 16:02:32 -0500
- Subject: [gfortran] patch for PR 16196, error on OPEN(...STATUS='REPLACE')
tested i686/gnu/linux with no additional testsuite failures:
test file:
PROGRAM iobug
OPEN(UNIT=10,FILE='gfcoutput.txt',status='REPLACE')
END PROGRAM iobug
Changelog:
2004-06-25 Bud Davis <bdavis9659@comcast.net>
PR gfortran/16196
* unix.c(regular_file): create file if it does not exist.
--bud
Index: gcc/libgfortran/io/unix.c
===================================================================
RCS file: /cvs/gcc/gcc/libgfortran/io/unix.c,v
retrieving revision 1.5
diff -c -3 -p -r1.5 unix.c
*** gcc/libgfortran/io/unix.c 18 May 2004 16:06:09 -0000 1.5
--- gcc/libgfortran/io/unix.c 25 Jun 2004 20:52:47 -0000
*************** regular_file (unit_action action, unit_s
*** 982,988 ****
break;
case STATUS_REPLACE:
! mode |= O_TRUNC;
break;
default:
--- 982,991 ----
break;
case STATUS_REPLACE:
! if (stat (path, &statbuf) < 0)
! mode |= O_CREAT | O_EXCL;
! else
! mode |= O_TRUNC;
break;
default: