Overview
| Artifact ID: | 6eea7be95f0abd119ab58b258568b5d7c6e0bf75 |
|---|---|
| Ticket: | 219360ffffffffffffffffffffffffffffffffff |
| Date: | 2001-09-13 05:56:11 |
| User: | hobbs |
| Artifact Attached: | 3e92b7b45ce6d75def1b7011b16edce93c1ca13c |
| Filename: | 219360.c |
| Description: |
Content:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61/* C 2001 UK test for [ tcl-Bugs-219360 ] open does not notice EIO in check for tty running this on Linux System 1 gives uwe@hal:~ > uname -a Linux hal 2.4.4-4GB #1 Wed May 16 00:37:55 GMT 2001 i686 unknown (SuSE 7.2) uwe@hal:~ > ./ttytest /dev/ttyS1 open "/dev/ttyS1" returns 3 (errno == 0) write returns "10" errno is 0 Success isatty returns "1" errno is 0 Success uwe@hal:~ > ./ttytest /dev/ttyS6 open "/dev/ttyS6" returns 3 (errno == 0) write returns "-1" errno is 5 Input/output error isatty returns "0" errno is 5 Input/output error uwe@hal:~ > running this on Linux System 2 gives uwe@james:~ > uname -a Linux james 2.2.14 #2 Don Apr 13 15:47:10 CEST 2000 i586 unknown (SuSE 6.3) uwe@james:~ > ./ttytest /dev/ttyS1 open "/dev/ttyS1" returns 3 (errno == 0) write returns "10" errno is 0 Sucess isatty returns "1" errno is 0 Success uwe@james:~ > ./ttytest /dev/ttyS6 open "/dev/ttyS6" returns 3 (errno == 0) write returns "-1" errno is 5 Input/output error isatty returns "0" errno is 5 Input/output error uwe@james:~ > */ #include <stdlib.h> #include <fcntl.h> #include <errno.h> #include <stdio.h> int main(int argc,char**argv,char**arge) { int fd = -1; int ret = 0; char *ttyname = "/dev/ttyS99"; if ( argc > 1 ) ttyname = argv[1]; fd = open(ttyname,O_RDWR); fprintf(stderr,"open \"%s\" returns %d (errno == %d)\n",ttyname,fd,errno); ret = write(fd,ttyname,strlen(ttyname)); fprintf(stderr,"write returns \"%d\" errno is %d ",ret,errno); perror(""); ret = isatty(fd); fprintf(stderr,"isatty returns \"%d\" errno is %d ",ret,errno); perror(""); exit; }