[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 4/4] Add a test suite for the sethostname module
From: |
Bruno Haible |
Subject: |
Re: [PATCH 4/4] Add a test suite for the sethostname module |
Date: |
Sat, 3 Dec 2011 15:29:03 +0100 |
User-agent: |
KMail/1.13.6 (Linux/2.6.37.6-0.5-desktop; KDE/4.6.0; x86_64; ; ) |
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 <address@hidden>
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ý>
[PATCH 2/4] Add a new sethostname module, Ben Walton, 2011/12/02
Re: [PATCH 2/4] Add a new sethostname module, Bruno Haible, 2011/12/04
Re: sethostname, Bruno Haible, 2011/12/04