]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
CURLMOPT_SOCKETFUNCTION.md: fix the callback argument use
authorDaniel Stenberg <daniel@haxx.se>
Thu, 4 Dec 2025 18:57:44 +0000 (19:57 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Thu, 4 Dec 2025 21:59:51 +0000 (22:59 +0100)
The example code does not use curl_multi_assign(), but its callback
function used socketp (called sockp in the function) to get the struct
priv pointer instead of the correct clientp (cbp).

Reported-by: Greg Hudson
Fixes #19840
Closes #19841

docs/libcurl/opts/CURLMOPT_SOCKETFUNCTION.md

index fae15d58a2a9035719379019cd78851d3995efd0..411b856e9328f04e3b536d3daf27f4ca93fb254a 100644 (file)
@@ -109,7 +109,7 @@ struct priv {
 
 static int sock_cb(CURL *e, curl_socket_t s, int what, void *cbp, void *sockp)
 {
-  struct priv *p = sockp;
+  struct priv *p = cbp;
   printf("our ptr: %p\n", p->ours);
 
   if(what == CURL_POLL_REMOVE) {