diff options
author | Daniel Baumann <mail@daniel-baumann.ch> | 2015-11-08 04:26:11 +0000 |
---|---|---|
committer | Daniel Baumann <mail@daniel-baumann.ch> | 2015-11-08 04:26:11 +0000 |
commit | 560efe7382b3ec435391d3f2fcda03cb08787ab9 (patch) | |
tree | 082803f81c2cf83b8b859df041fb007d5e57a24b /zutils.cc | |
parent | Adding upstream version 1.0~rc7. (diff) | |
download | zutils-560efe7382b3ec435391d3f2fcda03cb08787ab9.tar.xz zutils-560efe7382b3ec435391d3f2fcda03cb08787ab9.zip |
Adding upstream version 1.0.upstream/1.0
Signed-off-by: Daniel Baumann <mail@daniel-baumann.ch>
Diffstat (limited to '')
-rw-r--r-- | zutils.cc | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -54,13 +54,13 @@ int readblock( const int fd, uint8_t * const buf, const int size ) errno = 0; while( rest > 0 ) { - errno = 0; const int n = read( fd, buf + size - rest, rest ); if( n > 0 ) rest -= n; else if( n == 0 ) break; // EOF else if( errno != EINTR && errno != EAGAIN ) break; + errno = 0; } - return ( rest > 0 ) ? size - rest : size; + return size - rest; } @@ -73,12 +73,12 @@ int writeblock( const int fd, const uint8_t * const buf, const int size ) errno = 0; while( rest > 0 ) { - errno = 0; const int n = write( fd, buf + size - rest, rest ); if( n > 0 ) rest -= n; else if( n < 0 && errno != EINTR && errno != EAGAIN ) break; + errno = 0; } - return ( rest > 0 ) ? size - rest : size; + return size - rest; } |