@@ -43,7 +43,7 @@ static const char* tryNonThreadingFastPath(FFNetworkingState* state)
4343 TCP_FASTOPEN
4444 #endif
4545 , & flag , sizeof (flag )) != 0 ) {
46- FF_DEBUG ("Failed to set TCP_FASTOPEN option: %m" );
46+ FF_DEBUG ("Failed to set TCP_FASTOPEN option: %s" , strerror ( errno ) );
4747 return "setsockopt(TCP_FASTOPEN) failed" ;
4848 } else {
4949 #if __linux__ || __GNU__
@@ -73,7 +73,7 @@ static const char* tryNonThreadingFastPath(FFNetworkingState* state)
7373 state -> addr -> ai_addrlen );
7474 #else
7575 if (fcntl (state -> sockfd , F_SETFL , O_NONBLOCK ) == -1 ) {
76- FF_DEBUG ("fcntl(F_SETFL) failed: %m" );
76+ FF_DEBUG ("fcntl(F_SETFL) failed: %s" , strerror ( errno ) );
7777 return "fcntl(F_SETFL) failed" ;
7878 }
7979 FF_DEBUG ("Using connectx() to send %u bytes of data" , state -> command .length );
@@ -90,7 +90,7 @@ static const char* tryNonThreadingFastPath(FFNetworkingState* state)
9090 .iov_len = state -> command .length ,
9191 }, 1 , & sent , NULL ) != 0 ) sent = 0 ;
9292 if (fcntl (state -> sockfd , F_SETFL , 0 ) == -1 ) {
93- FF_DEBUG ("fcntl(F_SETFL) failed: %m" );
93+ FF_DEBUG ("fcntl(F_SETFL) failed: %s" , strerror ( errno ) );
9494 return "fcntl(F_SETFL) failed" ;
9595 }
9696 #endif
@@ -108,7 +108,7 @@ static const char* tryNonThreadingFastPath(FFNetworkingState* state)
108108 #else
109109 "sendto()"
110110 #endif
111- " %s (sent=%zd, %m )" , errno == 0 ? "succeeded" : "was in progress" , sent );
111+ " %s (sent=%zd, %s )" , errno == 0 ? "succeeded" : "was in progress" , sent , strerror ( errno ) );
112112 freeaddrinfo (state -> addr );
113113 state -> addr = NULL ;
114114 ffStrbufDestroy (& state -> command );
@@ -121,7 +121,7 @@ static const char* tryNonThreadingFastPath(FFNetworkingState* state)
121121 #else
122122 "sendto()"
123123 #endif
124- " failed: %m" );
124+ " failed: %s" , strerror ( errno ) );
125125 #ifdef __APPLE__
126126 return "connectx() failed" ;
127127 #else
@@ -142,7 +142,7 @@ static const char* connectAndSend(FFNetworkingState* state)
142142 FF_DEBUG ("Attempting connect() to server..." );
143143 if (connect (state -> sockfd , state -> addr -> ai_addr , state -> addr -> ai_addrlen ) == -1 )
144144 {
145- FF_DEBUG ("connect() failed: %m" );
145+ FF_DEBUG ("connect() failed: %s" , strerror ( errno ) );
146146 ret = "connect() failed" ;
147147 goto error ;
148148 }
@@ -151,7 +151,7 @@ static const char* connectAndSend(FFNetworkingState* state)
151151 FF_DEBUG ("Attempting to send %u bytes of data..." , state -> command .length );
152152 if (send (state -> sockfd , state -> command .chars , state -> command .length , 0 ) < 0 )
153153 {
154- FF_DEBUG ("send() failed: %m" );
154+ FF_DEBUG ("send() failed: %s" , strerror ( errno ) );
155155 ret = "send() failed" ;
156156 goto error ;
157157 }
@@ -226,7 +226,7 @@ static const char* initNetworkingState(FFNetworkingState* state, const char* hos
226226 state -> sockfd = socket (state -> addr -> ai_family , state -> addr -> ai_socktype , state -> addr -> ai_protocol );
227227 if (state -> sockfd == -1 )
228228 {
229- FF_DEBUG ("socket() failed: %m" );
229+ FF_DEBUG ("socket() failed: %s" , strerror ( errno ) );
230230 ret = "socket() failed" ;
231231 goto error ;
232232 }
@@ -236,7 +236,7 @@ static const char* initNetworkingState(FFNetworkingState* state, const char* hos
236236 #ifdef TCP_NODELAY
237237 // Disable Nagle's algorithm to reduce small packet transmission delay
238238 if (setsockopt (state -> sockfd , IPPROTO_TCP , TCP_NODELAY , & flag , sizeof (flag )) != 0 ) {
239- FF_DEBUG ("Failed to set TCP_NODELAY: %m" );
239+ FF_DEBUG ("Failed to set TCP_NODELAY: %s" , strerror ( errno ) );
240240 } else {
241241 FF_DEBUG ("Successfully disabled Nagle's algorithm" );
242242 }
@@ -245,7 +245,7 @@ static const char* initNetworkingState(FFNetworkingState* state, const char* hos
245245 #ifdef TCP_QUICKACK
246246 // Set TCP_QUICKACK option to avoid delayed acknowledgments
247247 if (setsockopt (state -> sockfd , IPPROTO_TCP , TCP_QUICKACK , & flag , sizeof (flag )) != 0 ) {
248- FF_DEBUG ("Failed to set TCP_QUICKACK: %m" );
248+ FF_DEBUG ("Failed to set TCP_QUICKACK: %s" , strerror ( errno ) );
249249 } else {
250250 FF_DEBUG ("Successfully enabled TCP quick acknowledgment" );
251251 }
@@ -398,7 +398,7 @@ const char* ffNetworkingRecvHttpResponse(FFNetworkingState* state, FFstrbuf* buf
398398 }
399399 else if (pollRes == -1 )
400400 {
401- FF_DEBUG ("poll() failed: %m" );
401+ FF_DEBUG ("poll() failed: %s" , strerror ( errno ) );
402402 close (state -> sockfd );
403403 state -> sockfd = -1 ;
404404 return "poll() failed" ;
@@ -418,7 +418,7 @@ const char* ffNetworkingRecvHttpResponse(FFNetworkingState* state, FFstrbuf* buf
418418
419419 if (shutdown (state -> sockfd , SHUT_WR ) == -1 )
420420 {
421- FF_DEBUG ("Failed to shutdown socket send: %m" );
421+ FF_DEBUG ("Failed to shutdown socket send: %s" , strerror ( errno ) );
422422 // Not a critical error, continue anyway
423423 }
424424
@@ -439,7 +439,7 @@ const char* ffNetworkingRecvHttpResponse(FFNetworkingState* state, FFstrbuf* buf
439439 if (received == 0 ) {
440440 FF_DEBUG ("Connection closed (received=0)" );
441441 } else {
442- FF_DEBUG ("Reception failed: %m" );
442+ FF_DEBUG ("Reception failed: %s" , strerror ( errno ) );
443443 }
444444 break ;
445445 }
0 commit comments