[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [msmtp-users] Build problem on Solaris
On Sat, 17. Feb 2007, 18:37:18 +0000, Eur Ing Chris Green wrote:
> Silly me - it's LOCL function so not available. So hstrerror really
> *isn't* available on Solaris 2.6.
>
> I might just try copying the libresolv.so from one of our 2.8 systems
> and see if I can build against that. It's odds on that it will fall
> in a crumpled heap because of dependencies but it's worth a try.
I think it's safer to just roll your own implementation of hstrerror().
It's just like strerror(), but for the h_errno codes that are set by
gethostbyname(). Only four error codes are possible. You could add the
following to src/net.c, line 64:
-----------------------------------------------------------
const char *hstrerror(int e)
{
/* The messages are taken from the hstrerror() of glibc-2.3.6 */
switch (e)
{
case HOST_NOT_FOUND:
return "Unknown host";
case TRY_AGAIN:
return "Host name lookup failure";
case NO_RECOVERY:
return "Unknown server error";
case NO_DATA:
return "No address associated with name";
default: /* should never happen */
return "Unknown error";
}
}
-----------------------------------------------------------
Or put this function into its own file together with the header lines
-----------------------------------------------------------
#include <netdb.h>
extern int h_errno;
-----------------------------------------------------------
then compile with
$ gcc -shared -o /usr/local/lib/hstrerror.so hstrerror.c
Then you can configure all programs that need hstrerror() with
LIBS="/usr/local/lib/hstrerror.so".
Regards,
Martin