getlogin_r on mingw
(too old to reply)
Bruno Haible
2016-12-17 11:08:16 UTC
Raw Message
I'm seeing this compilation failure on a recent mingw:

../../gltests/test-getlogin_r.c:31:17: fatal error: pwd.h: No such file or directory
compilation terminated.
make[4]: *** [Makefile:7987: test-getlogin_r.o] Error 1

This fixes it:

2016-12-17 Bruno Haible <***@clisp.org>

getlogin_r tests: Port to mingw.
* tests/test-getlogin_r.c: Don't include <pwd.h> on native Windows. Fixes
regression introduced on 2014-05-19.

diff --git a/tests/test-getlogin_r.c b/tests/test-getlogin_r.c
index 94e7ec7..7104d6a 100644
--- a/tests/test-getlogin_r.c
+++ b/tests/test-getlogin_r.c
@@ -28,7 +28,9 @@ SIGNATURE_CHECK (getlogin_r, int, (char *, size_t));
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
-#include <pwd.h>
+#if !((defined _WIN32 || defined __WIN32__) && !defined __CYGWIN__)
+# include <pwd.h>

#include <sys/stat.h>
#include <sys/types.h>