testbound works on XP.

ioctlsocket nicer error message.

git-svn-id: file:///svn/unbound/trunk@1126 be551aaa-1e26-0410-a405-d3ace91eadb9
This commit is contained in:
Wouter Wijngaards 2008-06-18 08:16:04 +00:00
parent d4cfee1f00
commit 7be0e5b814
5 changed files with 26 additions and 4 deletions

View file

@ -1,3 +1,9 @@
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.

View file

@ -64,8 +64,20 @@ ub_ctx_create()
{
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));
@ -231,6 +243,9 @@ ub_ctx_delete(struct ub_ctx* ctx)
alloc_clear(&ctx->superalloc);
traverse_postorder(&ctx->queries, delq, NULL);
free(ctx);
#ifdef USE_WINSOCK
WSACleanup();
#endif
}
int

View file

@ -235,7 +235,6 @@ replay_moment_read(char* remain, FILE* in, const char* name, int* lineno,
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);

View file

@ -177,7 +177,7 @@ setup_playback(const char* filename, char* configfile,
int lineno = 0;
if(filename) {
FILE *in = fopen(filename, "r");
FILE *in = fopen(filename, "rb");
if(!in) {
perror(filename);
exit(1);

View file

@ -96,7 +96,8 @@ fd_set_nonblock(int s)
#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;
@ -119,7 +120,8 @@ fd_set_block(int s)
#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;