diff options
author | Jakob Odersky <jodersky@gmail.com> | 2014-03-28 16:50:26 +0100 |
---|---|---|
committer | Jakob Odersky <jodersky@gmail.com> | 2014-03-28 16:50:26 +0100 |
commit | dddd1b4509cec1f4c25e6189f10186562f115fac (patch) | |
tree | 30c6456bb5255372fa8bfe393c0e2c3b5913838a /flow/src/main/native/posix/flow.c | |
parent | b6f27be4eda4ec0e50aaca8eb3a117db60b4067e (diff) | |
download | akka-serial-dddd1b4509cec1f4c25e6189f10186562f115fac.tar.gz akka-serial-dddd1b4509cec1f4c25e6189f10186562f115fac.tar.bz2 akka-serial-dddd1b4509cec1f4c25e6189f10186562f115fac.zip |
implement direct buffers
Diffstat (limited to 'flow/src/main/native/posix/flow.c')
-rw-r--r-- | flow/src/main/native/posix/flow.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/flow/src/main/native/posix/flow.c b/flow/src/main/native/posix/flow.c index c408670..7f7d54b 100644 --- a/flow/src/main/native/posix/flow.c +++ b/flow/src/main/native/posix/flow.c @@ -38,9 +38,10 @@ int serial_open( int fd = open(port_name, O_RDWR | O_NOCTTY | O_NONBLOCK); if (fd < 0) { + int en = errno; DEBUG(perror("error obtaining port file descriptor");); - if (errno == EACCES) return E_ACCESS_DENIED; - if (errno == ENOENT) return E_NO_PORT; + if (en == EACCES) return E_ACCESS_DENIED; + if (en == ENOENT) return E_NO_PORT; return E_IO; } @@ -214,7 +215,7 @@ int serial_read(struct serial_config* const serial, char* const buffer, size_t s //treat 0 bytes read as an error to avoid problems on disconnect //anyway, after a poll there should be more than 0 bytes available to read if (r <= 0) { - DEBUG(perror("read");); + DEBUG(perror("error data not available after select");); return E_IO; } return r; |