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

Re: [msmtp-users] Build problem on Solaris



On Sun, Feb 18, 2007 at 02:23:58PM +0100, Martin Lambers wrote:
> 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";
>     }
> }
> -----------------------------------------------------------
> 
Excellent, thank you very much.  I've added the above to net.c and now
get a successful build of msmtp.  I'll leave testing it until Monday
now (it's a work system) as I only have an ssh link from here at home.

-- 
Chris Green