Ben Walton wrote: > +#if !HAVE_GETEUID > +# define geteuid() ((uid_t) -1) > +#endif
On mingw, I'm getting a compilation error: test-sethostname.c: In function `main': test-sethostname.c:58: error: `uid_t' undeclared (first use in this function) test-sethostname.c:58: error: (Each undeclared identifier is reported only once test-sethostname.c:58: error: for each function it appears in.) This fixes it, and enables testing sethostname() also on mingw. 2011-12-03 Bruno Haible <br...@clisp.org> sethostname tests: Fix compilation error on mingw. * tests/test-sethostname.c: Don't include <sys/types.h>. (geteuid): Use a dummy value without uid_t. --- tests/test-sethostname.c.orig Sat Dec 3 15:26:00 2011 +++ tests/test-sethostname.c Sat Dec 3 15:25:57 2011 @@ -24,8 +24,6 @@ /* for HOST_NAME_MAX */ #include <limits.h> -/* for uid_t */ -#include <sys/types.h> /* for strlen */ #include <string.h> @@ -36,11 +34,9 @@ #define TESTHOSTNAME "gnulib-hostname" -/* mingw and MSVC 9 lack geteuid, so setup a value that will indicate - we don't have root privilege since we wouldn't know whether to - expect success or failure when setting a name anyway*/ +/* mingw and MSVC 9 lack geteuid, so setup a dummy value. */ #if !HAVE_GETEUID -# define geteuid() ((uid_t) -1) +# define geteuid() 0 #endif int -- In memoriam Rudolf Slánský <http://en.wikipedia.org/wiki/Rudolf_Slánský>