summaryrefslogtreecommitdiffstats
path: root/src/tests/parec-simple.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/tests/parec-simple.c')
-rw-r--r--src/tests/parec-simple.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/tests/parec-simple.c b/src/tests/parec-simple.c
index ea34a075..0312005d 100644
--- a/src/tests/parec-simple.c
+++ b/src/tests/parec-simple.c
@@ -47,7 +47,7 @@ static ssize_t loop_write(int fd, const void*data, size_t size) {
ret += r;
data = (const uint8_t*) data + r;
- size -= r;
+ size -= (size_t) r;
}
return ret;
@@ -80,6 +80,9 @@ int main(int argc, char*argv[]) {
goto finish;
}
+ if (r == 0)
+ break;
+
/* And write it to STDOUT */
if ((r = loop_write(STDOUT_FILENO, buf, sizeof(buf))) <= 0) {
fprintf(stderr, __FILE__": write() failed: %s\n", strerror(errno));