This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[patch, libgfortran] Fix PR59108 ACTION='READ' is using O_CREAT
- From: Jerry DeLisle <jvdelisle at charter dot net>
- To: fortran at gcc dot gnu dot org, gcc patches <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 15 Nov 2013 11:11:34 -0800
- Subject: [patch, libgfortran] Fix PR59108 ACTION='READ' is using O_CREAT
- Authentication-results: sourceware.org; auth=none
The attached patch sets the create flag for the case where action is specified
as read only.
I have confirmed that the PR test case now only produces:
open("wombat", O_RDONLY) = 3
open("numbat", O_RDONLY) = 4
open("dingbat", O_RDONLY) = 5
+++ exited with 0 +++
I can not think of a test case for this.
Regression tested on x86-64 Linux.
OK for trunk?
Regards,
Jerry
2013-11-15 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR fortran/59108
* io/unix.c (regular_file): If the ACTION is read only set
create flag to zero.
Index: unix.c
===================================================================
--- unix.c (revision 204848)
+++ unix.c (working copy)
@@ -1329,6 +1329,10 @@ regular_file (st_parameter_open *opp, unit_flags *
break;
case STATUS_UNKNOWN:
+ crflag = 0;
+ if (flags->action == ACTION_READ)
+ break;
+ /* Fall through. */
case STATUS_SCRATCH:
crflag = O_CREAT;
break;