diff options
author | Luke Shumaker <lukeshu@lukeshu.com> | 2017-09-03 12:16:40 -0400 |
---|---|---|
committer | Luke Shumaker <lukeshu@lukeshu.com> | 2017-09-03 12:16:40 -0400 |
commit | c613da7ab3a296b2477b473c178d2d8afd981165 (patch) | |
tree | 43a839fbd57e6c7ad74131cf91cbf6ed4b854434 | |
parent | 3fe67a2e8096a772fd59f4fc45dfcb2a7658cfac (diff) |
nshd-tester: simplify the full_write routine
-rw-r--r-- | bin/nshd-tester.c | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/bin/nshd-tester.c b/bin/nshd-tester.c index d4d3a09..8667ec0 100644 --- a/bin/nshd-tester.c +++ b/bin/nshd-tester.c @@ -164,14 +164,10 @@ int main(int argc, char *argv[]) { ssize_t bytes_written = 0; while (bytes_written < bytes_read) { ssize_t n = write(STDERR_FILENO, &(buf[bytes_written]), bytes_read-bytes_written); - if (n < 0) { - bytes_written = -1; - break; - } + if (n < 0) + error(EXIT_FAILURE, errno, "write"); bytes_written += n; } - if (bytes_written < 0) - error(EXIT_FAILURE, errno, "write"); } assert_not_reached(); } |