Corrected error handling for ws_getprotobyname/number.
Made the Async error returns the same as the normal functions.
diff --git a/dlls/winsock/async.c b/dlls/winsock/async.c
index fa17d33c..6f96c3e 100644
--- a/dlls/winsock/async.c
+++ b/dlls/winsock/async.c
@@ -90,6 +90,11 @@
DEFAULT_DEBUG_CHANNEL(winsock)
+/* protoptypes of some functions in socket.c
+ */
+UINT16 wsaErrno(void);
+UINT16 wsaHerrno(void);
+
/* ----------------------------------- helper functions - */
static int list_size(char** l, int item_size)
@@ -308,7 +313,7 @@
size = -size;
}
} else {
- fail = WSAENOBUFS;
+ fail = ((h_errno < 0) ? wsaErrno() : wsaHerrno());
}
}
break;
@@ -325,7 +330,13 @@
size = -size;
}
} else {
- fail = WSAENOBUFS;
+ if (aq->flags & AQ_NAME)
+ MESSAGE("protocol %s not found; You might want to add "
+ "this to /etc/protocols\n", debugstr_a(aq->proto_name) );
+ else
+ MESSAGE("protocol number %d not found; You might want to add "
+ "this to /etc/protocols\n", aq->proto_number );
+ fail = WSANO_DATA;
}
}
break;
@@ -342,7 +353,15 @@
size = -size;
}
} else {
- fail = WSAENOBUFS;
+ if (aq->flags & AQ_NAME)
+ MESSAGE("service %s protocol %s not found; You might want to add "
+ "this to /etc/services\n", debugstr_a(aq->serv_name) ,
+ aq->serv_proto ? debugstr_a(aq->serv_proto ):"*");
+ else
+ MESSAGE("service on port %d protocol %s not found; You might want to add "
+ "this to /etc/services\n", aq->serv_port,
+ aq->serv_proto ? debugstr_a(aq->serv_proto ):"*");
+ fail = WSANO_DATA;
}
}
break;
diff --git a/dlls/winsock/socket.c b/dlls/winsock/socket.c
index 5fd70de..248e2c3 100644
--- a/dlls/winsock/socket.c
+++ b/dlls/winsock/socket.c
@@ -1964,8 +1964,12 @@
if( WS_dup_pe(pwsi, proto, dup_flag) )
return (struct WIN_protoent*)(pwsi->pe);
else SetLastError(WSAENOBUFS);
- else SetLastError((h_errno < 0) ? wsaErrno() : wsaHerrno());
- }
+ else {
+ MESSAGE("protocol %s not found; You might want to add "
+ "this to /etc/protocols\n", debugstr_a(name) );
+ SetLastError(WSANO_DATA);
+ }
+ } else SetLastError(WSANOTINITIALISED);
return NULL;
}
@@ -1998,8 +2002,12 @@
if( WS_dup_pe(pwsi, proto, dup_flag) )
return (struct WIN_protoent*)(pwsi->pe);
else SetLastError(WSAENOBUFS);
- else SetLastError(WSANO_DATA);
- }
+ else {
+ MESSAGE("protocol number %d not found; You might want to add "
+ "this to /etc/protocols\n", number );
+ SetLastError(WSANO_DATA);
+ }
+ } else SetLastError(WSANOTINITIALISED);
return NULL;
}
@@ -2038,7 +2046,7 @@
return (struct WIN_servent*)(pwsi->se);
else SetLastError(WSAENOBUFS);
else {
- MESSAGE("service %s protocol %s not found; maybe you have add "
+ MESSAGE("service %s protocol %s not found; You might want to add "
"this to /etc/services\n", debugstr_a(pwsi->buffer),
proto ? debugstr_a(pwsi->buffer+i):"*");
SetLastError(WSANO_DATA);
@@ -2083,7 +2091,7 @@
else SetLastError(WSAENOBUFS);
}
else {
- MESSAGE("service on port %d protocol %s not found; maybe you have "
+ MESSAGE("service on port %d protocol %s not found; You might want to add "
"add this to /etc/services\n", ntohl(port),
proto ? debugstr_a(pwsi->buffer) : "*");
SetLastError(WSANO_DATA);
@@ -2498,7 +2506,8 @@
}
return FALSE;
}
-/*********************************************************
+
+/***********************************************************************
* WS_s_perror WSOCK32.1108
*/
void WINAPI WS_s_perror(LPCSTR message)