Skip to content

Commit 71eb3e1

Browse files
committed
in_docker_events: validate return value of read() (CID 304911)
Signed-off-by: Eduardo Silva <[email protected]>
1 parent cd54540 commit 71eb3e1

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

plugins/in_docker_events/docker_events.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
*/
4040
static int de_unix_create(struct flb_in_de_config *ctx)
4141
{
42+
ssize_t bytes;
4243
unsigned long len;
4344
size_t address_length;
4445
struct sockaddr_un address;
@@ -65,7 +66,11 @@ static int de_unix_create(struct flb_in_de_config *ctx)
6566
write(ctx->fd, request, strlen(request));
6667

6768
/* Read the initial http response */
68-
read(ctx->fd, ctx->buf, ctx->buf_size - 1);
69+
bytes = read(ctx->fd, ctx->buf, ctx->buf_size - 1);
70+
if (bytes == -1) {
71+
flb_errno();
72+
}
73+
flb_plg_debug(ctx->ins, "read %zu bytes from socket", bytes);
6974

7075
return 0;
7176
}

0 commit comments

Comments
 (0)