Janne Blomqvist <jb@gcc.gnu.org>
PR fortran/50016
* io/file_pos.c (st_flush): Call _commit on MinGW(-w64).
* io/intrinsics.c (flush_i4, flush_i8): Ditto.
* io/unix.c (flush_all_units_1, flush_all_units): Ditto.
(buf_flush): Remove _commit call.
* io/inquire.c (inquire_via_unit): Flush internal buffer
and call file_length instead of invoking stat via file_size.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_6-branch@180138
138bc75d-0d04-0410-961f-
82ee72b054a4
+2011-10-18 Tobias Burnus <burnus@net-b.de>
+ Janne Blomqvist <jb@gcc.gnu.org>
+
+ PR fortran/50016
+ * io/file_pos.c (st_flush): Call _commit on MinGW(-w64).
+ * io/intrinsics.c (flush_i4, flush_i8): Ditto.
+ * io/unix.c (flush_all_units_1, flush_all_units): Ditto.
+ (buf_flush): Remove _commit call.
+ * io/inquire.c (inquire_via_unit): Flush internal buffer
+ and call file_length instead of invoking stat via file_size.
+
2011-09-11 Thomas Koenig <tkoenig@gcc.gnu.org>
Backport fron trunk
fbuf_flush (u, u->mode);
sflush (u->s);
+#ifdef _WIN32
+ /* Without _commit, changes are not visible to other file descriptors. */
+ _commit (u->s->fd);
+#endif
unlock_unit (u);
}
else
if (u == NULL)
*iqp->size = -1;
else
- *iqp->size = file_size (u->file, (gfc_charlen_type) u->file_len);
+ {
+ sflush (u->s);
+ *iqp->size = file_length (u->s);
+ }
}
}
if (us != NULL)
{
sflush (us->s);
+#ifdef _WIN32
+ /* Without _commit, changes are not visible
+ to other file descriptors. */
+ _commit (u->s->fd);
+#endif
unlock_unit (us);
}
}
if (us != NULL)
{
sflush (us->s);
+#ifdef _WIN32
+ /* Without _commit, changes are not visible
+ to other file descriptors. */
+ _commit (u->s->fd);
+#endif
unlock_unit (us);
}
}
if (s->ndirty != 0)
return -1;
-#ifdef _WIN32
- _commit (s->fd);
-#endif
-
return 0;
}
if (__gthread_mutex_trylock (&u->lock))
return u;
if (u->s)
- sflush (u->s);
+ {
+ sflush (u->s);
+#ifdef _WIN32
+ /* Without _commit, changes are not visible to other
+ file descriptors. */
+ _commit (u->s->fd);
+#endif
+ }
__gthread_mutex_unlock (&u->lock);
}
u = u->right;
if (u->closed == 0)
{
sflush (u->s);
+#ifdef _WIN32
+ /* Without _commit, changes are not visible to other
+ file descriptors. */
+ _commit (u->s->fd);
+#endif
__gthread_mutex_lock (&unit_lock);
__gthread_mutex_unlock (&u->lock);
(void) predec_waiting_locked (u);