open.c (already_open): Test for POSIX close return value.

2009-04-08  Janne Blomqvist  <jb@gcc.gnu.org>

        * io/open.c (already_open): Test for POSIX close return value.
        * io/unit.c (close_unit_1): Likewise.
        * io/unix.c (raw_close): Return 0 for success for preconnected units.

From-SVN: r145761
This commit is contained in:
Janne Blomqvist 2009-04-08 20:06:34 +03:00
parent 557cc596c9
commit 2ac7316d99
4 changed files with 9 additions and 3 deletions

View File

@ -1,3 +1,9 @@
2009-04-08 Janne Blomqvist <jb@gcc.gnu.org>
* io/open.c (already_open): Test for POSIX close return value.
* io/unit.c (close_unit_1): Likewise.
* io/unix.c (raw_close): Return 0 for success for preconnected units.
2009-04-08 Janne Blomqvist <jb@gcc.gnu.org>
* runtime/string.c (compare0): Use gfc_charlen_type.

View File

@ -682,7 +682,7 @@ already_open (st_parameter_open *opp, gfc_unit * u, unit_flags * flags)
}
#endif
if (sclose (u->s) == FAILURE)
if (sclose (u->s) == -1)
{
unlock_unit (u);
generate_error (&opp->common, LIBERROR_OS,

View File

@ -626,7 +626,7 @@ close_unit_1 (gfc_unit *u, int locked)
if (u->previous_nonadvancing_write)
finish_last_advance_record (u);
rc = (u->s == NULL) ? 0 : sclose (u->s) == FAILURE;
rc = (u->s == NULL) ? 0 : sclose (u->s) == -1;
u->closed = 1;
if (!locked)

View File

@ -349,7 +349,7 @@ raw_close (unix_stream * s)
&& s->fd != STDIN_FILENO)
retval = close (s->fd);
else
retval = SUCCESS;
retval = 0;
free_mem (s);
return retval;
}