OSDN Git Service

* io/unix.c (regular_file): For ACTION_UNSPECIFIED retry with
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 14 Mar 2007 12:14:58 +0000 (12:14 +0000)
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 14 Mar 2007 12:14:58 +0000 (12:14 +0000)
O_RDONLY even if errno is EROFS.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@122914 138bc75d-0d04-0410-961f-82ee72b054a4

libgfortran/ChangeLog
libgfortran/io/unix.c

index 7f90658..1e71f1d 100644 (file)
@@ -1,3 +1,8 @@
+2007-03-14  Jakub Jelinek  <jakub@redhat.com>
+
+       * io/unix.c (regular_file): For ACTION_UNSPECIFIED retry with
+       O_RDONLY even if errno is EROFS.
+
 2007-03-09  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
 
        PR libgfortran/31099
index 08f3287..b58df51 100644 (file)
@@ -1213,7 +1213,7 @@ regular_file (st_parameter_open *opp, unit_flags *flags)
       break;
 
     case STATUS_REPLACE:
-        crflag = O_CREAT | O_TRUNC;
+      crflag = O_CREAT | O_TRUNC;
       break;
 
     default:
@@ -1229,14 +1229,14 @@ regular_file (st_parameter_open *opp, unit_flags *flags)
   mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH;
   fd = open (path, rwflag | crflag, mode);
   if (flags->action != ACTION_UNSPECIFIED)
-      return fd;
+    return fd;
 
   if (fd >= 0)
     {
       flags->action = ACTION_READWRITE;
       return fd;
     }
-  if (errno != EACCES)
+  if (errno != EACCES && errno != EROFS)
      return fd;
 
   /* retry for read-only access */