]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
testbound works on XP.
authorWouter Wijngaards <wouter@nlnetlabs.nl>
Wed, 18 Jun 2008 08:16:04 +0000 (08:16 +0000)
committerWouter Wijngaards <wouter@nlnetlabs.nl>
Wed, 18 Jun 2008 08:16:04 +0000 (08:16 +0000)
ioctlsocket nicer error message.

git-svn-id: file:///svn/unbound/trunk@1126 be551aaa-1e26-0410-a405-d3ace91eadb9

doc/Changelog
libunbound/libunbound.c
testcode/replay.c
testcode/testbound.c
util/net_help.c

index bbab8f2eb55209026b66d860edb5fe6b8c3dd209..6701995e82242b4144144c7f202a64523428bf26 100644 (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.
index f027e6e3c54edcbc763f1faac49351f42f073f40..8cb146304e3d305d8ce83177270b235b59f2b8bf 100644 (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 
index 4d5da932cf051c68631e693f4ec51553f3324f51..1de5b132e5db763adac0374ac6d219a5f184ffa1 100644 (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);
index fcb4ab8cd29011b6dfda981c997570b0408be808..58330f1d87e5c0c1f873cf8388cef24ac8f2ef37 100644 (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);
index 21ffe5d779ea49750e0fc9dda3170c6ddfbbd45c..76cb6b619529882033dd9d2fa65f600b104597c4 100644 (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;