bug-gnulib
[Top][All Lists]
Advanced

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

Re: gethostname on Windows


From: Martin Lambers
Subject: Re: gethostname on Windows
Date: Sun, 2 Aug 2009 20:46:31 +0200
User-agent: Mutt/1.5.18 (2008-05-17)

On Sun, 02. Aug 2009, 12:04:53 +0200, Bruno Haible wrote:
> Simon Josefsson wrote:
> > Avoiding -lws2_32 is good, but if the application links to -lws2_32
> > anyway, there will be no saving.
> > [...]
> 
> [...]
> I'm now convinced that linking with -lws2_32 is the least evil.
> I have applied your patch from 2009-03-31.

Thanks to both of you!

> Also, I'm fixing the handling of len > INT_MAX.

This requires to include limits.h in gethostname.c, to get INT_MAX.

Martin


diff --git a/lib/gethostname.c b/lib/gethostname.c
index ef58a40..422184a 100644
--- a/lib/gethostname.c
+++ b/lib/gethostname.c
@@ -76,6 +76,9 @@ gethostname (char *name, size_t len)
 /* Get winsock2.h. */
 #include <unistd.h>
 
+/* Get INT_MAX. */
+#include <limits.h>
+
 /* Get set_winsock_errno. */
 #include "w32sock.h"
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]