mchome / dogcom

Drcom-generic implementation in C.
GNU Affero General Public License v3.0
187 stars 41 forks source link

[Windows] use WSAGetLastError() in Win32 build #25

Closed mchome closed 6 years ago

mchome commented 6 years ago

Use WSAGetLastError instead of using perror.

void DieWithError(char *errorMessage) { perror(errorMessage); exit(1); }

- Win32 build
```c
#include <winsock.h>
#include <stdlib.h>

void DieWithError(char *errorMessage) {
    fprintf(stderr,"%s: %d\n",
        errorMessage, WSAGetLastError());
    exit(1);
}