Re-order some code in dd(1)

This commit is contained in:
sin 2014-06-11 12:59:51 +01:00
parent 0ca8e52bc1
commit d2c215f9ab
1 changed files with 2 additions and 2 deletions

4
dd.c
View File

@ -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;