This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch, libgfortran] Fix PR59108 ACTION='READ' is using O_CREAT


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;

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]