[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v6 08/29] libqtest: Let socket_send() compute le
From: |
Thomas Huth |
Subject: |
Re: [Qemu-devel] [PATCH v6 08/29] libqtest: Let socket_send() compute length |
Date: |
Tue, 5 Sep 2017 10:12:30 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 |
On 01.09.2017 20:03, Eric Blake wrote:
> Rather than make multiple callers call strlen(), it's easier if
> socket_send() itself can compute a length via strlen() if none
> was provided (caller passes -1). Callers that can get at the
> length more efficiently are left that way.
>
> Signed-off-by: Eric Blake <address@hidden>
> ---
> tests/libqtest.c | 10 ++++++----
> 1 file changed, 6 insertions(+), 4 deletions(-)
I have to say that I don't like this idea very much. socket_send()
should IMHO not know about the type of the data that should be sent,
i.e. it should not assume that the content is a zero-terminated string.
This also could lead to some hard to detect bugs later in case somebody
is calling the function like this:
size = someotherfunction();
socket_send(fd, buf, size);
... and the someotherfunction() returned a negative error code instead
of a correct size.
So I'd like to suggest to simply drop this patch.
Thomas
- Re: [Qemu-devel] [PATCH v6 04/29] qtest: Don't perform side effects inside assertion, (continued)
- [Qemu-devel] [PATCH v6 07/29] libqtest: Remove dead qtest_instances variable, Eric Blake, 2017/09/01
- [Qemu-devel] [PATCH v6 10/29] libqtest: Topologically sort functions, Eric Blake, 2017/09/01
- [Qemu-devel] [PATCH v6 09/29] libqtest: Use qemu_strtoul(), Eric Blake, 2017/09/01
- [Qemu-devel] [PATCH v6 06/29] tests: Clean up wait for event, Eric Blake, 2017/09/01
- [Qemu-devel] [PATCH v6 08/29] libqtest: Let socket_send() compute length, Eric Blake, 2017/09/01
- Re: [Qemu-devel] [PATCH v6 08/29] libqtest: Let socket_send() compute length,
Thomas Huth <=
- [Qemu-devel] [PATCH v6 11/29] libqtest: Inline qtest_query_target_endianness(), Eric Blake, 2017/09/01
- [Qemu-devel] [PATCH v6 13/29] libqos: Use explicit QTestState for pci operations, Eric Blake, 2017/09/01
- [Qemu-devel] [PATCH v6 15/29] libqos: Use explicit QTestState for rtas operations, Eric Blake, 2017/09/01