From 2e7765f468c46728df16faa903d1f4b8a17f76fd Mon Sep 17 00:00:00 2001 From: Guo Wenxue <guowenxue@gmail.com> Date: Wed, 21 Sep 2022 23:09:27 +0800 Subject: [PATCH] update sqlite_blob.c --- apue/project_socket/src/socket.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) diff --git a/apue/project_socket/src/socket.c b/apue/project_socket/src/socket.c index 677a3cc..e6231e3 100644 --- a/apue/project_socket/src/socket.c +++ b/apue/project_socket/src/socket.c @@ -41,13 +41,14 @@ */ int socket_init(socket_ctx_t *sock, char *host, int port) { - if( !sock || !host || port<=0 ) + if( !sock || port<=0 ) return -1; memset( sock, 0, sizeof(*sock) ); sock->fd = -1; - strncpy(sock->host, host, HOSTNAME_LEN); sock->port = port; + if( host ) /* server no need it */ + strncpy(sock->host, host, HOSTNAME_LEN); } /* description: close socket @@ -83,6 +84,7 @@ if( !sock ) return -1; + set_socket_rlimit(); /* set max open socket count */ } /* description: socket connect to server in block mode -- Gitblit v1.9.1