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

Jovi Zhang bookjovi@REDACTED
Tue Dec 6 10:49:51 CET 2011


On Tue, Dec 6, 2011 at 4:51 PM, Henrik Nord <henrik@REDACTED> wrote:
> 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
>

Sorry, I missed that "*nbytes == 0" have special meaning used by upper layer.
I will take more carefully in next time.

I have removed "*nbytes == 0" part, please try below new patch.


>From cbfce8104b708e7df287b88783bf7bdc21dc1035 Mon Sep 17 00:00:00 2001
From: Jovi Zhang <bookjovi@REDACTED>
Date: Tue, 29 Nov 2011 05:23:56 +0800
Subject: [PATCH] erts: minor fix for unnecessary condition

In "while (retval != -1 && retval == SENDFILE_CHUNK_SIZE)", "retval !=
-1" is pointless.
---
erts/emulator/drivers/unix/unix_efile.c |    2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/erts/emulator/drivers/unix/unix_efile.c
b/erts/emulator/drivers/unix/unix_efile.c
index eb2c5f5..ebc82e2 100644
--- a/erts/emulator/drivers/unix/unix_efile.c
+++ b/erts/emulator/drivers/unix/unix_efile.c
@@ -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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-erts-minor-fix-for-unnecessary-condition.patch
Type: application/octet-stream
Size: 977 bytes
Desc: not available
URL: <http://erlang.org/pipermail/erlang-patches/attachments/20111206/01984482/attachment.obj>


More information about the erlang-patches mailing list