Re: 2.2.5ac1 & screen

Andreas Jaeger (aj@arthur.rhein-neckar.de)
12 Apr 1999 16:32:10 +0200


>>>>> William R McDonough writes:

> I noticed Alan wrote in his release notes this breaks screen.
> It broke mine.

> I tried downgrading the kernel, and screen... Is there any work around?

> Here is what I am seeing...

> I'm running Debian 2.2 (potato)

> [wrmcd@janitor: ~]$ screen -S bitchx bitchx
> Cannot access '/dev/ttyp˙˙˙˙˙˙˙˙': No such file or directory

That might be a bug in glibc 2.1. The latest glibc 2.1 debian package
should have this fixed.

I'm appending the patch below. The patch will be in glibc 2.1.1.

Andreas

1999-04-01 Andreas Jaeger <aj@arthur.rhein-neckar.de>

* sysdeps/unix/sysv/linux/ttyname.c (ttyname): Terminate the string.
* sysdeps/unix/sysv/linux/ttyname_r.c (__ttyname_r): Likewise.

Index: sysdeps/unix/sysv/linux/ttyname.c
===================================================================
--- ttyname.c 1999/03/08 11:46:01 1.8
+++ ttyname.c 1999/04/01 09:32:31 1.9
@@ -112,6 +112,7 @@
int dostat = 0;
char *name;
int save = errno;
+ int len;

if (!__isatty (fd))
return NULL;
@@ -130,10 +131,17 @@
}
}

- if (__readlink (procname, buf, buflen) != -1
+ len = __readlink (procname, buf, buflen);
+ if (len != -1
/* This is for Linux 2.0. */
&& buf[0] != '[')
- return buf;
+ {
+ if (len >= buflen)
+ return NULL;
+ /* readlink need not terminate the string. */
+ buf[len] = '\0';
+ return buf;
+ }

if (__fxstat (_STAT_VER, fd, &st) < 0)
return NULL;
Index: sysdeps/unix/sysv/linux/ttyname_r.c
===================================================================
--- ttyname_r.c 1999/03/08 11:46:10 1.9
+++ ttyname_r.c 1999/04/01 09:32:17 1.10
@@ -134,7 +134,10 @@

ret = __readlink (procname, buf, buflen - 1);
if (ret != -1 && buf[0] != '[')
- return 0;
+ {
+ buf[ret] = '\0';
+ return 0;
+ }
if (ret == -1 && errno == ENAMETOOLONG)
{
__set_errno (ERANGE);

-- 
 Andreas Jaeger   aj@arthur.rhein-neckar.de    jaeger@informatik.uni-kl.de
  for pgp-key finger ajaeger@aixd1.rhrk.uni-kl.de

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/