Skip to content

Commit 700519d

Browse files
committed
CID-24870: Unchecked return value from library
We don't care anyway, but we should be using the wrapper though
1 parent e8bc9cf commit 700519d

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

php_phongo.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -490,13 +490,6 @@ mongoc_stream_t* phongo_stream_initiator(const mongoc_uri_t *uri, const mongoc_h
490490
return NULL;
491491
}
492492

493-
if (host->family != AF_UNIX) {
494-
int socket = ((php_netstream_data_t*)stream->abstract)->socket;
495-
int flag = 1;
496-
497-
setsockopt(socket, IPPROTO_TCP, TCP_NODELAY, (char *) &flag, sizeof(int));
498-
}
499-
500493
base_stream = ecalloc(1, sizeof(php_phongo_stream_socket));
501494
base_stream->stream = stream;
502495
base_stream->uri_options = mongoc_uri_get_options(uri);
@@ -511,6 +504,11 @@ mongoc_stream_t* phongo_stream_initiator(const mongoc_uri_t *uri, const mongoc_h
511504
base_stream->vtable.setsockopt = phongo_stream_setsockopt;
512505
base_stream->vtable.get_base_stream = phongo_stream_get_base_stream;
513506

507+
if (host->family != AF_UNIX) {
508+
int flag = 1;
509+
phongo_stream_setsockopt((mongoc_stream_t *)base_stream, IPPROTO_TCP, TCP_NODELAY, (char *)&flag, sizeof(int));
510+
}
511+
514512
return (mongoc_stream_t *) base_stream;
515513
} /* }}} */
516514

0 commit comments

Comments
 (0)