[erlang-patches] [PATCH] erts: fix error logic in efile_sendfile

Henrik Nord henrik@REDACTED
Tue Dec 6 09:51:27 CET 2011


Hello!

We can not get the tests to pass with this patch.
can you rerun the test at your side and verify that they all pass?

Thank you

On 12/06/2011 07:51 AM, Jovi Zhang wrote:
> > From 501b8f4ab78c752ff11a794984aad547b8717c5f Mon Sep 17 00:00:00 2001
> From: Jovi Zhang<bookjovi@REDACTED>
> Date: Tue, 29 Nov 2011 02:11:01 +0800
> Subject: [PATCH] erts: fix error logic in efile_sendfile
>
> This commit fix two errors in efile_sendfile(linux env):
> 1) when *nbytes is 0, we should invoke sendfile with count *nbytes,
> not SENDFILE_CHUNK_SIZE
> 2) "while (retval != -1&&  retval == SENDFILE_CHUNK_SIZE)" is pointless,
>    replace it by "while (retval == SENDFILE_CHUNK_SIZE)"
> ---
> erts/emulator/drivers/unix/unix_efile.c |    4 ++--
> 1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/erts/emulator/drivers/unix/unix_efile.c
> b/erts/emulator/drivers/unix/unix_efile.c
> index eb2c5f5..fe0a0e2 100644
> --- a/erts/emulator/drivers/unix/unix_efile.c
> +++ b/erts/emulator/drivers/unix/unix_efile.c
> @@ -1492,7 +1492,7 @@ efile_sendfile(Efile_error* errInfo, int in_fd,
> int out_fd,
>      ssize_t retval;
>      do {
>        // check if *nbytes is 0 or greater than the largest size_t
> -      if (*nbytes == 0 || *nbytes>  SENDFILE_CHUNK_SIZE)
> +      if (*nbytes>  SENDFILE_CHUNK_SIZE)
>         retval = sendfile(out_fd, in_fd, offset, SENDFILE_CHUNK_SIZE);
>        else
>         retval = sendfile(out_fd, in_fd, offset, *nbytes);
> @@ -1500,7 +1500,7 @@ efile_sendfile(Efile_error* errInfo, int in_fd,
> int out_fd,
>         written += retval;
>         *nbytes -= retval;
>        }
> -    } while (retval != -1&&  retval == SENDFILE_CHUNK_SIZE);
> +    } while (retval == SENDFILE_CHUNK_SIZE);
>      *nbytes = written;
>      return check_error(retval == -1 ? -1 : 0, errInfo);
> #elif defined(DARWIN)
> --
> 1.7.2.3
>
>
> _______________________________________________
> erlang-patches mailing list
> erlang-patches@REDACTED
> http://erlang.org/mailman/listinfo/erlang-patches

-- 
/Henrik Nord Erlang/OTP

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-patches/attachments/20111206/122d4acc/attachment.htm>


More information about the erlang-patches mailing list