From 407f6ba57135c8bbfb763e1fe06a2bf048fb0ab9 Mon Sep 17 00:00:00 2001 From: James Juran Date: Sat, 22 May 1999 10:35:19 +0000 Subject: [PATCH] Print a more effective (and visible) error message when an application can't create a socket with type == SOCK_RAW. --- misc/winsock.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/misc/winsock.c b/misc/winsock.c index 3947cd732eb..03192c157e6 100644 --- a/misc/winsock.c +++ b/misc/winsock.c @@ -1645,7 +1645,7 @@ SOCKET WINAPI WINSOCK_socket(INT af, INT type, INT protocol) 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 @@ SOCKET WINAPI WINSOCK_socket(INT af, INT type, INT protocol) 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()); }