mirror of
https://github.com/apache/nuttx.git
synced 2026-05-26 10:46:28 +08:00
Ensure psock_socket and psock_accept initialize s_crefs to 1
This simplifies the caller usage
This commit is contained in:
+1
-5
@@ -60,11 +60,6 @@
|
||||
* socket() creates an endpoint for communication and returns a socket
|
||||
* structure.
|
||||
*
|
||||
* NOTE: This function does not set the reference count on the socket
|
||||
* structure. This down by the socket() front end when socket structure
|
||||
* was allocated. Internal OS users of psock_socket() must set the s_crefs
|
||||
* field to one if psock_socket() returns success.
|
||||
*
|
||||
* Input Parameters:
|
||||
* domain (see sys/socket.h)
|
||||
* type (see sys/socket.h)
|
||||
@@ -102,6 +97,7 @@ int psock_socket(int domain, int type, int protocol, FAR struct socket *psock)
|
||||
|
||||
/* Initialize the socket structure */
|
||||
|
||||
psock->s_crefs = 1;
|
||||
psock->s_domain = domain;
|
||||
psock->s_type = type;
|
||||
psock->s_conn = NULL;
|
||||
|
||||
Reference in New Issue
Block a user