New tty bug

Richard B. Johnson (root@analogic.com)
Thu, 12 Dec 1996 16:06:57 -0500 (EST)


/*
In the following, the device /dev/cua2, does not physically exist.
Therefore, the following routine should return a -1 and set errno
in some manner.

Instead, it hangs. If you ^C, it crashes. This relates to the setterm
problem that gives people Oopses upon startup. Setterm tries to open
each of these devices. It is done when an open fails.

*/

#include <stdio.h>
#include <unistd.h>
#include <errno.h>
#include <sys/fcntl.h>

main()
{
int fd;

fd = open("/dev/cua2", O_RDWR|O_NONBLOCK, 0);
fprintf(stdout, "Open() returned %d, (%s)\n", fd, strerror(errno));
return 0;
}

Linux 2.1.15
This bug was reported by myself as soon as the patch was available. I
discovered the bug as soon as I booted with the patched kernel.

Cheers,
Dick Johnson
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Richard B. Johnson
Project Engineer
Analogic Corporation
Voice : (508) 977-3000 ext. 3754
Fax : (508) 532-6097
Modem : (508) 977-6870
Ftp : ftp@boneserver.analogic.com
Email : rjohnson@analogic.com, johnson@analogic.com
Penguin : Linux version 2.1.15 on an i586 machine.
Warning : It's hard to remain at the trailing edge of technology.
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-