Print a more effective (and visible) error message when an application
can't create a socket with type == SOCK_RAW.
diff --git a/misc/winsock.c b/misc/winsock.c
index 3947cd7..03192c1 100644
--- a/misc/winsock.c
+++ b/misc/winsock.c
@@ -1645,7 +1645,7 @@
default: SetLastError(WSAEPROTOTYPE); return INVALID_SOCKET;
}
- if ((sock = socket(af, type, protocol)) >= 0)
+ if ((sock = socket(af, type, protocol)) >= 0)
{
ws_socket* pnew = wsi_alloc_socket(pwsi, sock);
@@ -1664,7 +1664,10 @@
if (errno == EPERM) /* raw socket denied */
{
- WARN(winsock, "WS_SOCKET: not enough privileges\n");
+ if (type == SOCK_RAW)
+ MSG("WARNING: Trying to create a socket of type SOCK_RAW, will fail unless running as root\n");
+ else
+ MSG("WS_SOCKET: not enough privileges to create socket, try running as root\n");
SetLastError(WSAESOCKTNOSUPPORT);
} else SetLastError(wsaErrno());
}