Patchwork [libfortran] PR 47432 Use thread-safe ttyname_r() if available

login
register
mail settings
Submitter Janne Blomqvist
Date Jan. 25, 2011, 6:25 p.m.
Message ID <AANLkTini5qFEvXD-5TucCLNOKV=Uy+BtHr61wTRL=1OH@mail.gmail.com>
Download mbox | patch
Permalink /patch/80394/
State New
Headers show

Comments

Janne Blomqvist - Jan. 25, 2011, 6:25 p.m.
On Tue, Jan 25, 2011 at 19:33, Janne Blomqvist
<blomqvist.janne@gmail.com> wrote:
> Hi,
>
> the attached patch makes libgfortran use the thread-safe ttyname_r()
> function if available.
>
> Regtested on x86_64-unknown-linux-gnu, Ok for trunk?
>
> --
> Janne Blomqvist
>

The following patch should be on top of the previous patch:

Patch

diff --git a/libgfortran/io/unix.c b/libgfortran/io/unix.c
index ad90552..004e860 100644
--- a/libgfortran/io/unix.c
+++ b/libgfortran/io/unix.c
@@ -1820,7 +1820,7 @@  stream_ttyname (stream *s  __attribute__ ((unused)),
   return ttyname_r (((unix_stream *) s)->fd, buf, buflen);
 #elif defined HAVE_TTYNAME
   char *p;
-  int plen;
+  size_t plen;
   p = ttyname (((unix_stream *) s)->fd);
   if (!p)
     return errno;