diff packages/hal/arm/edb7xxx/current/support/io.c @ 186:d60da272beeb

Merge from eCos master repository on 2001-10-05-06:43:03-BST
author jlarmour
date Fri, 05 Oct 2001 15:31:48 +0000
parents 022f1e506033
children e0c0827131d1
line wrap: on
line diff
--- a/packages/hal/arm/edb7xxx/current/support/io.c
+++ b/packages/hal/arm/edb7xxx/current/support/io.c
@@ -45,6 +45,7 @@
 #include <sys/ioctl.h>
 #include <fcntl.h>
 #include <termios.h>
+#include <errno.h>
 
 char _ReceiveChar(long port)
 {
@@ -142,6 +143,10 @@ int _CharReady(long port)
 #else
     int n, res;
     res = ioctl(port, FIONREAD, &n);
+    if (res < 0) {
+        fprintf(stderr, "I/O error: %s\n", strerror(errno));
+        exit(1);
+    }
     return n;  // Non-zero if characters ready to read
 #endif
 }