commit d2c215f9ab0878ecaae4362d83dec9ef257a16c4
parent 0ca8e52bc1fce74ba3d7ba9f07aa98bd22ae552a
Author: sin <sin@2f30.org>
Date: Wed, 11 Jun 2014 12:59:51 +0100
Re-order some code in dd(1)
Diffstat:
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/dd.c b/dd.c
@@ -158,8 +158,6 @@ copy_splice(struct dd_config *ddc)
#endif
n = ddc->bs;
for (;ddc->b_out != ddc->count && !sigint;) {
- if (n > ddc->count - ddc->b_out)
- n = ddc->count - ddc->b_out;
FD_ZERO(&rfd);
FD_ZERO(&wfd);
FD_SET(ifd, &rfd);
@@ -169,6 +167,8 @@ copy_splice(struct dd_config *ddc)
break;
}
if (FD_ISSET(ifd, &rfd) == 1 && FD_ISSET(ofd, &wfd) == 1) {
+ if (n > ddc->count - ddc->b_out)
+ n = ddc->count - ddc->b_out;
r = splice(ifd, NULL, p[1], NULL, n, SPLICE_F_MORE);
if (r <= 0) {
ddc->saved_errno = errno;