+18 June 2008: Wouter
+ - open testbound replay files in binary mode, because fseek/ftell
+ do not work in ascii-mode on windows. The b does nothing on unix.
+ unittest and testbound tests work on windows (xp too).
+ - ioctlsocket prints nicer error message.
+
17 June 2008: Wouter
- outgoing num fds 32 by default on windows ; it supports less
fds for waiting on than unixes.
{
struct ub_ctx* ctx;
unsigned int seed;
+#ifdef USE_WINSOCK
+ int r;
+ WSADATA wsa_data;
+#endif
+
log_init(NULL, 0, NULL); /* logs to stderr */
log_ident_set("libunbound");
+#ifdef USE_WINSOCK
+ if((r = WSAStartup(MAKEWORD(2,2), &wsa_data)) != 0) {
+ log_err("could not init winsock. WSAStartup: %s",
+ wsa_strerror(r));
+ return NULL;
+ }
+#endif
verbosity = 0; /* errors only */
checklock_start();
ctx = (struct ub_ctx*)calloc(1, sizeof(*ctx));
alloc_clear(&ctx->superalloc);
traverse_postorder(&ctx->queries, delq, NULL);
free(ctx);
+#ifdef USE_WINSOCK
+ WSACleanup();
+#endif
}
int
remain++;
if(strlen(remain) > 0) /* remove \n */
remain[strlen(remain)-1] = 0;
- printf("remain '%s'\n", remain);
if(!extstrtoaddr(remain, &mom->addr, &mom->addrlen)) {
log_err("line %d: could not parse ADDRESS: %s",
*lineno, remain);
int lineno = 0;
if(filename) {
- FILE *in = fopen(filename, "r");
+ FILE *in = fopen(filename, "rb");
if(!in) {
perror(filename);
exit(1);
#elif defined(HAVE_IOCTLSOCKET)
unsigned long on = 1;
if(ioctlsocket(s, FIONBIO, &on) != 0) {
- log_err("can't ioctlsocket FIONBIO on: %d", WSAGetLastError());
+ log_err("can't ioctlsocket FIONBIO on: %s",
+ wsa_strerror(WSAGetLastError()));
}
#endif
return 1;
#elif defined(HAVE_IOCTLSOCKET)
unsigned long off = 0;
if(ioctlsocket(s, FIONBIO, &off) != 0) {
- log_err("can't ioctlsocket FIONBIO off: %d", WSAGetLastError());
+ log_err("can't ioctlsocket FIONBIO off: %s",
+ wsa_strerror(WSAGetLastError()));
}
#endif
return 1;