1
0
mirror of https://github.com/prirun/p50em.git synced 2026-04-12 22:56:47 +00:00

devamlc: fix ttymsg bug

This commit is contained in:
Jim
2011-09-17 15:21:13 -04:00
parent ff48e0c07a
commit d1596b5e82

View File

@@ -268,7 +268,7 @@ int devamlc (int class, int func, int device) {
int optval;
int tsflags;
struct sockaddr_in addr;
int fd;
int fd, ttyfd;
unsigned int addrlen;
char buf[1024]; /* max size of DMQ buffer */
int i, j, n, maxn, n2, nw;
@@ -888,11 +888,11 @@ int devamlc (int class, int func, int device) {
/* send out the ttymsg greeting */
if ((fd = open("ttymsg", O_RDONLY, 0)) >= 0) {
n = read(fd, buf, sizeof(buf));
if ((ttyfd = open("ttymsg", O_RDONLY, 0)) >= 0) {
n = read(ttyfd, buf, sizeof(buf));
if (n > 0)
write(fd, buf, n);
close(fd);
close(ttyfd);
} else if (errno != ENOENT) {
perror("Unable to open ttymsg file");
}