aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libgfortran/ChangeLog6
-rw-r--r--libgfortran/intrinsics/fget.c6
-rw-r--r--libgfortran/intrinsics/ftell.c11
-rw-r--r--libgfortran/intrinsics/tty.c2
4 files changed, 21 insertions, 4 deletions
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog
index 216a0a7..b874dc5 100644
--- a/libgfortran/ChangeLog
+++ b/libgfortran/ChangeLog
@@ -1,3 +1,9 @@
+2005-11-28 Jakub Jelinek <jakub@redhat.com>
+
+ * intrinsics/ftell.c (ftell, FTELL_SUB): Add unlock_unit call.
+ * intrinsics/fget.c (fgetc, fputs): Likewise.
+ * intrinsics/tty.c (ttynam): Likewise.
+
2005-11-27 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR libgfortran/25109
diff --git a/libgfortran/intrinsics/fget.c b/libgfortran/intrinsics/fget.c
index 8eb96e3..5c87ae6 100644
--- a/libgfortran/intrinsics/fget.c
+++ b/libgfortran/intrinsics/fget.c
@@ -54,6 +54,7 @@ PREFIX(fgetc) (const int * unit, char * c, gfc_charlen_type c_len)
s = 1;
memset (c, ' ', c_len);
ret = sread (u->s, c, &s);
+ unlock_unit (u);
if (ret != 0)
return ret;
@@ -118,13 +119,16 @@ PREFIX(fputc) (const int * unit, char * c,
gfc_charlen_type c_len __attribute__((unused)))
{
size_t s;
+ int ret;
gfc_unit * u = find_unit (*unit);
if (u == NULL)
return -1;
s = 1;
- return swrite (u->s, c, &s);
+ ret = swrite (u->s, c, &s);
+ unlock_unit (u);
+ return ret;
}
diff --git a/libgfortran/intrinsics/ftell.c b/libgfortran/intrinsics/ftell.c
index 16cf275..311f070 100644
--- a/libgfortran/intrinsics/ftell.c
+++ b/libgfortran/intrinsics/ftell.c
@@ -42,10 +42,12 @@ size_t
PREFIX(ftell) (int * unit)
{
gfc_unit * u = find_unit (*unit);
+ size_t ret;
if (u == NULL)
return ((size_t) -1);
- else
- return ((size_t) stream_offset (u->s));
+ ret = (size_t) stream_offset (u->s);
+ unlock_unit (u);
+ return ret;
}
#define FTELL_SUB(kind) \
@@ -58,7 +60,10 @@ PREFIX(ftell) (int * unit)
if (u == NULL) \
*offset = -1; \
else \
- *offset = stream_offset (u->s); \
+ { \
+ *offset = stream_offset (u->s); \
+ unlock_unit (u); \
+ } \
}
FTELL_SUB(1)
diff --git a/libgfortran/intrinsics/tty.c b/libgfortran/intrinsics/tty.c
index 63c2a5e..93416f9 100644
--- a/libgfortran/intrinsics/tty.c
+++ b/libgfortran/intrinsics/tty.c
@@ -121,8 +121,10 @@ ttynam (char ** name, gfc_charlen_type * name_len, int unit)
{
*name_len = strlen (*name);
*name = strdup (*name);
+ unlock_unit (u);
return;
}
+ unlock_unit (u);
}
*name_len = 0;