Package: screen
Version: 4.1.0~20120320gitdb59704-7
Severity: normal

Dear Maintainer,

screen is patched to check terminal it is starting on (debian/patches/47screen-
cc.patch)

Terminal device is required to be a normal character device, but it is not
always the case.

E. g. on illumos/solaris /dev/console is a symbolic link to
/devices/pseudo/cn@0:console

I'm attaching a patch which adjusts the check for symlinks.




-- System Information:
Debian Release: 7.0
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'unstable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 3.2.0-2-amd64 (SMP w/4 CPU cores)
Locale: LANG=ru_RU.UTF-8, LC_CTYPE=ru_RU.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages screen depends on:
ii  dpkg          1.16.9
ii  install-info  4.13a.dfsg.1-10
ii  libc6         2.13-37
ii  libpam0g      1.1.3-7.1
ii  libtinfo5     5.9-10

screen recommends no packages.

Versions of packages screen suggests:
pn  iselect | screenie | byobu  <none>

-- debconf information excluded
Description: /dev/console may be a symlink
 See http://lists.debian.org/debian-devel/2013/01/msg00576.html
 In case of SunOS kernel (illumos) it is not possible for a device
 file to have st_nlink != 1, so do not bother with "/devices/"
Index: screen/tty.sh
===================================================================
--- screen.orig/tty.sh	2013-01-27 02:16:57.916935245 +0000
+++ screen/tty.sh	2013-01-27 02:33:12.831241123 +0000
@@ -1506,11 +1506,21 @@
 char *tty;
 {
   struct stat st;
+  char * real;
+  int rc;
 
-  if (lstat(tty, &st) || !S_ISCHR(st.st_mode) ||
-     (st.st_nlink > 1 && strncmp(tty, "/dev/", 5)))
+  real = realpath(tty, NULL);
+  if (!real)
     return -1;
-  return 0;
+  
+  if (lstat(real, &st) || !S_ISCHR(st.st_mode) ||
+    (st.st_nlink > 1 && strncmp(real, "/dev/", 5)))
+    rc = -1;
+  else
+    rc = 0;
+
+  free(real);
+  return rc;
 }
 
 /*

Reply via email to