NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: _res in GNUMail



Hi,

The fix is easy (if it is realy single threaded), basically provide your own

        res_state my_res;

and use

        res_ninit(&my_res)

instead of

        res_init();
apparently, _res is used only in a few places, so perhaps I can provide a patch that implements the method differenty for netbsd (and perhaps other operating systems which provide res_ninit())

This is what I tried:

include these headers  (from the manual page):
#elif defined (__NetBSD__)
#include <sys/types.h>
#include <netinet/in.h>
#include <arpa/nameser.h>
#include <resolv.h>
#include <res_update.h>

in this case I get:
In file included from CWDNSManager.m:39:0:
/usr/include/res_update.h:29:22: fatal error: isc/list.h: No such file or directory

I commented that header out.

I then do:
  res_state cw_res;

  memset(&cw_res, 0, sizeof(cw_res));

  if (res_ninit(&cw_res) == -1)
      return;

  if ((cw_res->options & RES_INIT) == 0)
    return;

which is about what you suggest, but I get:
this warning:
CWDNSManager.m:448:3: warning: passing argument 1 of '__res_ninit' from incompatible pointer type /usr/include/resolv.h:466:6: note: expected 'res_state' but argument is of type 'struct __res_state **'

as if res_ninit(cw_res) was correct. But that looks wrong. Looking over the net, I found few examples using res_nsinit()
Some use this for declaration instead of res_state:

struct __res_state state;

But then accessing the structure with "->" is wrong and the code becomes like:

 if ((cw_res.options & RES_INIT) == 0)

this code doesn't crash anymore, what do you think? THe program still doesn't work, but apparently for other reasons.


Thanks
  Riccardp



Home | Main Index | Thread Index | Old Index