aboutsummaryrefslogtreecommitdiffstats
path: root/src/vcl/vcom_socket.c
diff options
context:
space:
mode:
authorDave Wallace <dwallacelf@gmail.com>2017-11-19 11:20:02 -0500
committerDave Wallace <dwallacelf@gmail.com>2017-11-19 11:20:02 -0500
commite376f9339897df86b63f3c827f4750b7ce7d10c0 (patch)
tree4278c86ebfd6781e809c8c396f5ebd54d002f676 /src/vcl/vcom_socket.c
parentcabbee7d8caeafa3959f4559177ae335567aefb4 (diff)
VCL-LDPRELOAD: Fix CID179207
Change-Id: Ia6b9e39d5a2ef064cf71bfe87cb4b4a0648d735d Signed-off-by: Dave Wallace <dwallacelf@gmail.com>
Diffstat (limited to 'src/vcl/vcom_socket.c')
-rw-r--r--src/vcl/vcom_socket.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/src/vcl/vcom_socket.c b/src/vcl/vcom_socket.c
index 6450eddc895..e87fd8a9092 100644
--- a/src/vcl/vcom_socket.c
+++ b/src/vcl/vcom_socket.c
@@ -1557,8 +1557,17 @@ vcom_socket_sendfile (int __out_fd, int __in_fd, off_t * __offset,
do
{
- bytes_to_read = vppcom_session_attr (out_sid,
- VPPCOM_ATTR_GET_NWRITE, 0, 0);
+ rv = vppcom_session_attr (out_sid, VPPCOM_ATTR_GET_NWRITE, 0, 0);
+ if (rv < 0)
+ {
+ clib_warning ("[%d] ERROR: vppcom_session_attr (out_sid (%u), "
+ "VPPCOM_ATTR_GET_NWRITE, 0, 0) returned %d (%s)!",
+ getpid (), out_sid, rv, vppcom_retval_str (rv));
+ vec_reset_length (vsm->io_buffer);
+ return rv;
+ }
+
+ bytes_to_read = (size_t) rv;
if (VCOM_DEBUG > 2)
clib_warning ("[%d] results %ld, n_bytes_left %lu, "
"bytes_to_read %lu", getpid (), results,
@@ -1606,8 +1615,10 @@ vcom_socket_sendfile (int __out_fd, int __in_fd, off_t * __offset,
if (rv < 0)
{
clib_warning ("[%d] ERROR: vppcom_session_write ("
- "out_sid %u, io_buffer %p, nbytes %d) returned %d",
- getpid (), out_sid, vsm->io_buffer, nbytes, rv);
+ "out_sid %u, io_buffer %p, nbytes %d) "
+ "returned %d (%s)",
+ getpid (), out_sid, vsm->io_buffer, nbytes,
+ rv, vppcom_retval_str (rv));
if (results == 0)
{
vec_reset_length (vsm->io_buffer);