screen says "Bad tty" if /dev/console is a symlink
Before filling a bug, I need a review :-)
The patch fo screen.cc [1] introduces the function CheckTtyname():
int
CheckTtyname (tty)
char *tty;
{
struct stat st;
if (lstat(tty, &st) || !S_ISCHR(st.st_mode) ||
(st.st_nlink > 1 && strncmp(tty, "/dev/", 5)))
return -1;
return 0;
}
When I run screen on a "real" console, screen says "Bad tty '/dev/console'"
I guess this is due to:
1. /dev/console is a symlink (don't ask ;-):
# ls -lh /dev/console
lrwxrwxrwx 1 root root 30 May 13 2012 /dev/console ->
../devices/pseudo/cn@0:console
2. lstat() stats a symlink itself, and it is obviosly not a character device.
Does it make sense to replace lstat() with stat()?
[1] http://anonscm.debian.org/gitweb/?p=collab-maint/screen.git;a=blob;f=debian/patches/47screen-cc.patch;h=a8f58e6c0c61fab6250e952e2707af0ff98b8452;hb=HEAD
Reply to: