mirror of
https://github.com/curl/curl.git
synced 2026-08-26 02:03:32 +03:00
socketpair() usage tracking to allow fd leak detection
This commit is contained in:
parent
5cdbfa1837
commit
bcbac913d6
7 changed files with 156 additions and 30 deletions
|
|
@ -285,6 +285,24 @@ curl_socket_t curl_socket(int domain, int type, int protocol,
|
|||
return sockfd;
|
||||
}
|
||||
|
||||
#ifdef HAVE_SOCKETPAIR
|
||||
int curl_socketpair(int domain, int type, int protocol,
|
||||
curl_socket_t socket_vector[2],
|
||||
int line, const char *source)
|
||||
{
|
||||
const char *fmt = (sizeof(curl_socket_t) == sizeof(int)) ?
|
||||
"FD %s:%d socketpair() = %d %d\n" :
|
||||
(sizeof(curl_socket_t) == sizeof(long)) ?
|
||||
"FD %s:%d socketpair() = %ld %ld\n" :
|
||||
"FD %s:%d socketpair() = %zd %zd\n" ;
|
||||
|
||||
int res = socketpair(domain, type, protocol, socket_vector);
|
||||
if(source && (0 == res))
|
||||
curl_memlog(fmt, source, line, socket_vector[0], socket_vector[1]);
|
||||
return res;
|
||||
}
|
||||
#endif
|
||||
|
||||
curl_socket_t curl_accept(curl_socket_t s, void *saddr, void *saddrlen,
|
||||
int line, const char *source)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue