aboutsummaryrefslogtreecommitdiffstats
path: root/Crystalfontz.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 /Crystalfontz.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 'Crystalfontz.c')
-rw-r--r--Crystalfontz.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/Crystalfontz.c b/Crystalfontz.c
index c88f55d..599ff0a 100644
--- a/Crystalfontz.c
+++ b/Crystalfontz.c
@@ -1,4 +1,4 @@
-/* $Id: Crystalfontz.c,v 1.6 2001/02/13 09:00:13 reinelt Exp $
+/* $Id: Crystalfontz.c,v 1.7 2001/04/27 05:04:57 reinelt Exp $
*
* driver for display modules from Crystalfontz
*
@@ -19,6 +19,12 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Log: Crystalfontz.c,v $
+ * Revision 1.7 2001/04/27 05:04:57 reinelt
+ *
+ * replaced OPEN_MAX with sysconf()
+ * replaced mktemp() with mkstemp()
+ * unlock serial port if open() fails
+ *
* Revision 1.6 2001/02/13 09:00:13 reinelt
*
* prepared framework for GPO's (general purpose outputs)
@@ -93,16 +99,19 @@ struct termios portset;
fd=open(Port,O_RDWR|O_NOCTTY|O_NDELAY);
if (fd==-1) {
error ("Crystalfontz: open(%s) failed: %s", Port, strerror(errno));
+ unlock_port(Port);
return -1;
}
if (tcgetattr(fd,&portset)==-1) {
error ("Crystalfontz: tcgetattr(%s) failed: %s", Port, strerror(errno));
+ unlock_port(Port);
return -1;
}
cfmakeraw(&portset);
cfsetospeed(&portset,Speed);
if (tcsetattr(fd, TCSANOW, &portset)==-1) {
error ("Crystalfontz: tcsetattr(%s) failed: %s", Port, strerror(errno));
+ unlock_port(Port);
return -1;
}
return fd;