From d1596b5e826bad1b03236000ff0c220e98d6aff7 Mon Sep 17 00:00:00 2001 From: Jim Date: Sat, 17 Sep 2011 15:21:13 -0400 Subject: [PATCH] devamlc: fix ttymsg bug --- devamlc.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/devamlc.h b/devamlc.h index 4742b85..ef43ee6 100644 --- a/devamlc.h +++ b/devamlc.h @@ -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"); }