aboutsummaryrefslogtreecommitdiffstats
path: root/BeckmannEgle.c
diff options
context:
space:
mode:
authorreinelt <>2001-04-27 05:04:57 +0000
committerreinelt <>2001-04-27 05:04:57 +0000
commit5cbe3de330c73d872a58699bf49ae42125c67b11 (patch)
tree28dd45bfdc2b53e3d1be653408d485419a49a410 /BeckmannEgle.c
parent2c64f2a07f139e300151f9e7e30333a8ab041c6e (diff)
downloadlcd4linux-5cbe3de330c73d872a58699bf49ae42125c67b11.tar.gz
[lcd4linux @ 2001-04-27 05:04:57 by reinelt]
replaced OPEN_MAX with sysconf() replaced mktemp() with mkstemp() unlock serial port if open() fails
Diffstat (limited to 'BeckmannEgle.c')
-rw-r--r--BeckmannEgle.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/BeckmannEgle.c b/BeckmannEgle.c
index bc6055e..51bf98e 100644
--- a/BeckmannEgle.c
+++ b/BeckmannEgle.c
@@ -1,4 +1,4 @@
-/* $Id: BeckmannEgle.c,v 1.5 2001/02/13 09:00:13 reinelt Exp $
+/* $Id: BeckmannEgle.c,v 1.6 2001/04/27 05:04:57 reinelt Exp $
*
* driver for Beckmann+Egle mini terminals
*
@@ -20,6 +20,12 @@
*
*
* $Log: BeckmannEgle.c,v $
+ * Revision 1.6 2001/04/27 05:04:57 reinelt
+ *
+ * replaced OPEN_MAX with sysconf()
+ * replaced mktemp() with mkstemp()
+ * unlock serial port if open() fails
+ *
* Revision 1.5 2001/02/13 09:00:13 reinelt
*
* prepared framework for GPO's (general purpose outputs)
@@ -137,10 +143,12 @@ static int BE_open (void)
fd = open(Port, O_RDWR | O_NOCTTY | O_NDELAY);
if (fd==-1) {
error ("BeckmannEgle: open(%s) failed: %s", Port, strerror(errno));
+ unlock_port(Port);
return -1;
}
if (tcgetattr(fd, &portset)==-1) {
error ("BeckmannEgle: tcgetattr(%s) failed: %s", Port, strerror(errno));
+ unlock_port(Port);
return -1;
}
cfmakeraw(&portset); // 8N1
@@ -148,6 +156,7 @@ static int BE_open (void)
cfsetospeed(&portset, B9600); // 9600 baud
if (tcsetattr(fd, TCSANOW, &portset)==-1) {
error ("BeckmannEgle: tcsetattr(%s) failed: %s", Port, strerror(errno));
+ unlock_port(Port);
return -1;
}
return fd;