File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -407,7 +407,11 @@ static int _modbus_tcp_pi_connect(modbus_t *ctx)
407407 rc = getaddrinfo (ctx_tcp_pi -> node , ctx_tcp_pi -> service , & ai_hints , & ai_list );
408408 if (rc != 0 ) {
409409 if (ctx -> debug ) {
410+ #ifdef HAVE_GAI_STRERROR
410411 fprintf (stderr , "Error returned by getaddrinfo: %s\n" , gai_strerror (rc ));
412+ #else
413+ fprintf (stderr , "Error returned by getaddrinfo: %d\n" , rc );
414+ #endif
411415 }
412416 freeaddrinfo (ai_list );
413417 errno = ECONNREFUSED ;
@@ -633,7 +637,11 @@ int modbus_tcp_pi_listen(modbus_t *ctx, int nb_connection)
633637 rc = getaddrinfo (node , service , & ai_hints , & ai_list );
634638 if (rc != 0 ) {
635639 if (ctx -> debug ) {
640+ #ifdef HAVE_GAI_STRERROR
636641 fprintf (stderr , "Error returned by getaddrinfo: %s\n" , gai_strerror (rc ));
642+ #else
643+ fprintf (stderr , "Error returned by getaddrinfo: %d\n" , rc );
644+ #endif
637645 }
638646 freeaddrinfo (ai_list );
639647 errno = ECONNREFUSED ;
You can’t perform that action at this time.
0 commit comments